Saturday, 15 June 2013

java - Error while testing Wikixmlj -


I Wikipedia to remove data from pages like, so I reach Wikipedia Dnps my test class code:

package wikiXmlj; Import edu.jhu.nlp.wikipedia. *; Public class Test {public static void main (String Algs []) {WikiXMLParser wxsp = WikiXMLParserFactory.getSAXParser ( "D: \\ simplewiki-20140501-pages-articles.xml.bz2"); Try {wxsp.parse (); WikiPageIterator = wxsp.getIterator (); While (this is the HesmorPage ()) {wiki page page = it.nextPage (); Println (page.getTitle ()); }} Hold (exception e) {e.printStackTrace (); }}}

Do not get me ttheis error:

  java.lang.UnsupportedOperationException at edu.jhu.nlp.wikipedia.WikiXMLSAXParser.getIterator (WikiXMLSAXParser   

use this code .....

  public zero WikiDumpReader (string Dnpfail) {WikiXMLParser wxsp = WikiXMLParserFactory.getSAXParser (Dnpfail); System.out.println (to be processed "dump file"); {Wxsp.setPageCallback (new Prishtcolbakhandlr) {@Override public void process (Wiki Page page) {System.out.println (page.getTitle ());}}); Wxsp.parse (); } Hold (exception e) {System.err.println ("Error:" + E); }}  

This is working for me. Reef


No comments:

Post a Comment