期待文件中的异常结束在解析XML数据的黑莓应用程序 [英] Expecting End of File Exception in parsing xml data for Blackberry application

查看:624
本文介绍了期待文件中的异常结束在解析XML数据的黑莓应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到解析器的例外是期待文件结束,而解析XML数据的黑莓应用程序吗?

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

如何解决呢?

推荐答案

我遇到了同样的org.xml.sax.SAXException同时制定了子类org.xml.sax.helpers.DefaultHandler中的关于处理XML文件黑莓。

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.

在我的情况的问题是,没有得到很好的形成我的示例XML文件。具体而言,有在XML文件中不只有一个根元素。我破碎的XML文件有几个根级标签,而SAX抱怨,它找到了第二个。这个文件看起来是这样的:

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>

您可以看到几个的XML规则维基百科在这里。

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

这篇关于期待文件中的异常结束在解析XML数据的黑莓应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆