XML 'Parse' method returns logcat error

Quoptwept

New Member
I'm trying to parse an XML from a URL using the SAX method described here as well as taking notes from this site. When I run the app though the \[code\]AsyncTask\[/code\] which runs the parser is suspended and the logcat reads:\[code\]10-09 20:55:50.480: W/System.err(29649): org.apache.harmony.xml.ExpatParser$ParseException: At line 575, column 34: not well-formed (invalid token)10-09 20:55:50.480: W/System.err(29649): at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:515)10-09 20:55:50.490: W/System.err(29649): at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:474)10-09 20:55:50.490: W/System.err(29649): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:321)10-09 20:55:50.490: W/System.err(29649): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:279)10-09 20:55:50.490: W/System.err(29649): at com.pack.fullmetalmanga.xml.SaxHelper.parse(SaxHelper.java:33)10-09 20:55:50.490: W/System.err(29649): at com.pack.fullmetalmanga.MainActivity$loadingTask.doInBackground(MainActivity.java:53)10-09 20:55:50.490: W/System.err(29649): at com.pack.fullmetalmanga.MainActivity$loadingTask.doInBackground(MainActivity.java:1)10-09 20:55:50.490: W/System.err(29649): at android.os.AsyncTask$2.call(AsyncTask.java:287)10-09 20:55:50.490: W/System.err(29649): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)10-09 20:55:50.500: W/System.err(29649): at java.util.concurrent.FutureTask.run(FutureTask.java:137)10-09 20:55:50.500: W/System.err(29649): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)10-09 20:55:50.500: W/System.err(29649): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)10-09 20:55:50.500: W/System.err(29649): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)10-09 20:55:50.500: W/System.err(29649): at java.lang.Thread.run(Thread.java:856)\[/code\]The lines of code to which it refers to in my app are:\[code\] public ArrayList<Manga> parse() { SAXParserFactory factory = SAXParserFactory.newInstance(); ArrayList<Manga> ParsedList = new ArrayList<Manga>(); try { SAXParser parser = factory.newSAXParser(); MangaHandler handler = new MangaHandler(); XMLReader xr = parser.getXMLReader(); xr.setContentHandler(handler); xr.parse(new InputSource(url2.openStream())); ParsedList = handler.getMangaList(); // returns a list of all the parsed manga } catch (Exception e) { e.printStackTrace(); } return ParsedList; }\[/code\]and my \[code\]AsyncTask\[/code\] :\[code\]class loadingTask extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... urls) { SaxHelper sh = null; try { sh = new SaxHelper(urls[0]); } catch (MalformedURLException e) { e.printStackTrace(); } MangaList = sh.parse(); return null; } @Override protected void onPostExecute(String s){ Log.d("Reading: ", "Reading all mangas.."); setContentView(R.layout.main); new chapterLoadingTask().execute(); } } class chapterLoadingTask extends AsyncTask <String, Void, String> { @Override protected String doInBackground(String... arg0) { ImageSaxHelper ish = null; for (Manga manga : MangaList) { try { ish = new ImageSaxHelper(manga.getMangaURL()); } catch (MalformedURLException e) { e.printStackTrace(); } manga.setChapters(ish.parse()); manga.setCoverURL(ish.parseCoverUrl()); manga.setMangaSummary(ish.parseMangaSummary()); manga.getArrays(); MangaSQL.addManga(manga); } return null; } @Override protected void onPostExecute(String s) { MangaList = MangaSQL.getAllMangas(); list1.setAdapter(new EfficientAdapter(MainActivity.this, MangaList)); // The 'debug pointer" points to this line after the task suspends ShowProgress.dismiss(); } }\[/code\]To clarify the second \[code\]AsyncTask\[/code\] uses a URL from each \[code\]Manga\[/code\] object parsed in the first task to load information of each chapter into said \[code\]Manga\[/code\], and although the debug pointer points at the line inside the second \[code\]AsyncTask\[/code\] the logcat points to the SaxHelper useed by the first task. Im very confused in where the problem actually is and how I would go about to fix this.
 
Back
Top