开发者

Expecting End of File Exception in parsing xml data for Blackberry application

开发者 https://www.devze.com 2022-12-12 00:06 出处:网络
I am getting parser exception as \"Expecting End of File\" while parsing xml data for Blackberry application?

I am getting parser exception as "Expecting End of File" while parsing xml data for Blackberry application?

How do I开发者_StackOverflow社区 fix it?


I encountered the the same org.xml.sax.SAXException while developing a child class of org.xml.sax.helpers.DefaultHandler for processing an XML file on Blackberry.

The issue in my case was that my sample XML file was not well-formed. Specifically, there was not only one root element in the XML file. My broken XML file had several root-level tags, and SAX was complaining that it found a second one. The file looked something like this:

<?xml version="1.0"?>
<number>one</number>
<number>two</number>
<number>three</number>

To fix it, I just encapsulated those items into one root element named "counting":

<?xml version="1.0"?>
<counting>
<number>one</number>
<number>two</number>
<number>three</number>
</counting>

You can see a few of the XML rules on Wikipedia here.

0

精彩评论

暂无评论...
验证码 换一张
取 消