我正在向服务器发送SOAP请求并获得以下响应。我正在使用DDXMLParser解析响应。但是,解析器将此解释为无效的XML。我非常确定<return>
标记内的数据必须包含在[!CDATA]
块中。使用NSXML Parser
进行解析时,我得到NSXMLParser Error Domain 64
。
我不确定现在该怎么办。
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<return>
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
</book>
</catalog>
</return>
</soapenv:Body>
</soapenv:Envelope>
答案 0 :(得分:1)
任何文档只能有一个XML声明,并且必须位于文档的最开头。
解析器会将此视为文档嵌套或XML声明的不正确放置,这两种情况都会导致错误。
**<?xml version="1.0" encoding="utf-8"?>**
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<return>
**<?xml version="1.0"?>**
<catalog>