xml解析问题!急
我是利用axiom对xml进行解析!
但却出现下面的错误!
Exception in thread "main" org.apache.axiom.om.OMException: [com.ctc.wstx.exc.WstxLazyException] com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' ' (code 32) (missing name?)
at [row,col {unknown-source}]: [136,53]
程序在执行有些xml文件时没有问题,有些却有问题。我很苦恼!是不是我的xml文件有问题啊?
Java code:
public class AxiomDemo {
public static void writeToFile(OutputStream os, byte[] b) {//写内容写到文件里面
try {
os.write(b, 0, b.length);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void writeToFile(OutputStream os, OMElement om) {
try {
String str = om.toStringWithConsume();
byte[] b = str.getBytes();
//os.write(b, 0, b.length);
writeToFile(os, b);
} catch (XMLStreamException e) {
// TODO: handle exception
}
}
public static OMElement readQuestionXml(InputStream is) {
OMElement om = null;
try {
XMLStreamReader parser = XMLInputFactory.newInstance()
.createXMLStreamReader(is);
StAXOMBuilder builder = new StAXOMBuilder(parser);
相关问答:
DataSet导出xml 批处理(循环)得怎么处理
XML文件
<A>
<B>
<C>
</C>
&nb ......
从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式
XML code:
<folder state="unchecked" label="全部">
<folder state="unchecked&qu ......
从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式文件
<folder state="unchecked" label="全部">
<folder state="unchecked" isBra ......
思路:要用c#生成一个播放机的播放列表的xml,例如:
<daty datys='2010-04-05' datye='2010-05-01' > //这是播放的日期段
<time times='01:12:00' timee='02:30:00'> ......