If your example is the entire XML you try to parse, then the exception
is valid.
Here is the snippet i tried:

<category term="user/xyz/state/com.google/reading-list" scheme="http://
www.google.com/reader/" label="reading-list"/>
<category term="user/xyz/state/com.google/fresh" scheme="http://
www.google.com/reader/" label="fresh"/>
<category term="&lt;![CDATA[ Agenda ]]&gt;"/>

taken from your post.

Your example is not a valid XML document: It is missing a root-
element.
This would be valid:

<some_root_elm>
  <category term="user/xyz/state/com.google/reading-list"
scheme="http://www.google.com/reader/"; label="reading-list"/>
  <category term="user/xyz/state/com.google/fresh" scheme="http://
www.google.com/reader/" label="fresh"/>
  <category term="&lt;![CDATA[ Agenda ]]&gt;"/>
</some_root_elm>


When I tried to paste your example in an XML editor, i got a similar
error that you got in your DOM parser. The fact that ']]>' is
mentioned may be because it is the last thing parsed in your XML
snippet.

Try to put a root-element as the parent of your three category
elements and see if you still get the problem.

On Apr 22, 8:08 am, Mariano Kamp <[email protected]> wrote:
> Hi,
>
>   yesterday I bitched about all the issues I have with the kXML
> parser. 
> (http://groups.google.com/group/android-developers/browse_thread/threa...)
>
>   So now I converted my code to use DOM. And I tried the third example
> from my referenced mail and it gives me an exception too.
>
>   I get a SAXParseExeption when parsing an atom feed from Google Reader:
>
> org.xml.sax.SAXParseException: Illegal: ]]> (position:START_TAG
> <category term='user/xyz/state/com.google/fresh'>@5:15061 in
> java.io.bufferedrea...@4348a0e8)
>         at 
> org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImp­l.java:151)
>         at com.newsrob.U.parseXMLfromInputStream(U.java:45)
>         at 
> com.newsrob.EntriesRetriever.fetchNewEntries(EntriesRetriever.java:299)
>         at 
> com.newsrob.SynchronizationService$4.run(SynchronizationService.java:172)
>         at 
> com.newsrob.SynchronizationService.doSync(SynchronizationService.java:337)
>         at 
> com.newsrob.SynchronizationService.access$0(SynchronizationService.java:86)
>         at 
> com.newsrob.SynchronizationService$1.run(SynchronizationService.java:75)
>         at java.lang.Thread.run(Thread.java:935)
>
>  I think the problem originates here (see the last category tag):
>
> <category term="user/xyz/state/com.google/reading-list"
> scheme="http://www.google.com/reader/"; label="reading-list"/><category
> term="user/xyz/state/com.google/fresh"
> scheme="http://www.google.com/reader/"; label="fresh"/><category
> term="&lt;![CDATA[ Agenda ]]&gt;"/>
>
>  Any idea why this happens?
>
>  This is the (abbreviated) code I use to parse the stream from Google Reader.
>
> DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> dbf.setCoalescing(true); // added this later with no effect
>
> DocumentBuilder builder = dbf.newDocumentBuilder();
>
> BufferedReader br = new BufferedReader(new
> InputStreamReader(is,"UTF-8"), 8 * 1024);
> builder.parse(new InputSource(br));
>
>   Any help is appreciated.
>
>   Is there a third parser on Android, besides Harmony's SAXParser and
> kXML's Pull Parser?
>
> Cheers,
> Mariano
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to