0

我正在向服务器发送 SOAP 请求并获得以下响应。我正在使用 DDXMLParser 解析响应。但是,解析器将此解释为无效的 XML。我很确定<return> 标签内的数据必须包装在[!CDATA]块中。使用NSXML Parseri am getting解析时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>
4

1 回答 1

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>
于 2013-05-14T05:44:30.107 回答