Load wiki page and contents with gwtwiki

209 Views Asked by At

For developing android application which shows my own wiki (mediawiki) content, I wanna use gwtwiki or bliki.

I tried a lot to read the contents or pages but nothing done.

Here is one of the test I've done:

public void readContent() {
    String[] listOfTitleStrings = { "Main Page", "API" };
    User user = new User("", "", "http://192.168.0.2/mediawiki/api.php");
    user.login();
    List<Page> listOfPages = user.queryCategories(listOfTitleStrings);

    Toast.makeText(getActivity(), "Pages size: " + listOfPages.size(), Toast.LENGTH_LONG).show();

    for (Page page : listOfPages) {
        for (int j = 0; j < page.sizeOfCategoryList(); j++) {
            Category cat = page.getCategory(j);
            Toast.makeText(getActivity(), cat.toString(), Toast.LENGTH_LONG).show();
        }
    }
}

For this sample the size of pages is 0. I used user.getContent(listOfTitleStrings); but nothing happened again.

How can I use gwtwiki? Must I read the page by HTML GET command and fetch the XML from response content then show it? Or gwtwiki do it itself?

1

There are 1 best solutions below

0
On BEST ANSWER

As I figure out by debugging my application, gwtwiki or bliki has error on read XML in android platform.

I made new Android project and changed it to Library. Then I copied the core part and resources folder of bliki to it without renaming. Then it's used in my application as a library. So I faced some error on running my application such as XML Parser instantiation error on constructor of AbstractXMLParser class.

I changed the code on constructor of AbstractXMLParser class and it is working well:

fXMLReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();

instead of:

fXMLReader = XMLReaderFactory.createXMLReader();