1
伙计!我已经得到了来自服务器的XML,我试图与Android SAX解析:解析不带根元素的xml
<?xml version="1.0" encoding="utf-8"?>
<News id="148364">
<Title>Title</Title>
<Desc>Desc</Desc>
<Body>Body</Body>
<Source_URL>example.url</Source_URL>
<Source_Title>Title</Source_Title_Heb>
<News_Date_Txt>20/06/11 18:14</News_Date_Txt>
<News_Attachment>/Downloads/News_148364_1.htm</News_Attachment>
</News>
当我试图做到以下几点:
RootElement root=new RootElement("News");
我收到异常:
android.sax.BadXmlException: root element name does not match. Expected "News", Got "http://www.w3.org/1999/xhtml:html"
会是什么呢?我如何得到没有根的子节点?
你试过打印出你解析什么?它看起来像我不喜欢解析你认为你的XML文档... –
除了公民conn的评论,它似乎xml嵌入在html文档内部左右。服务器如何将XML发送给您?再看看你在解析什么。 – codinguser
外面的机会有一个命名空间问题。 –