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

点点圈 提交于 2019-12-25 17:17:47

问题


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

How do I fix it?


回答1:


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.



来源:https://stackoverflow.com/questions/1755569/expecting-end-of-file-exception-in-parsing-xml-data-for-blackberry-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!