在 iPhone 上使用 NSXMLParser 处理 NOAA 数据时出现问题
谁能帮我看看为什么 NSXMLParser 不会导致这些方法
parser:didStartElement:namespaceURI:qualifiedName:attributes:
parser:didEndElement:namespaceURI:qualifiedName:attributes:
针对以下数据的部分触发:(
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:NDFDgenResponse xmlns:ns1=""><dwmlOut xsi:type="xsd:string"><?xml version="1.0"?>
<dwml version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd">
不包括正文)
</dwml>
</dwmlOut></ns1:NDFDgenResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
我不是 XML 专家,但对我来说,
部分看起来只是一个常规元素,就像它之前的部分一样进行解析。
我确实得到两个 parser:parseErrorOccurred: 错误,#200 和 #201,但它们发生在解析
元素期间,而不是
元素,所以我不确定它们是否相关。感谢您能给我的任何帮助。
更新:我的一位朋友离线告诉我上述数据中有几个错误。我不明白为什么 NOAA 会发送格式错误的 XML ——解析它有什么秘密吗?
Can anyone help me see why NSXMLParser is not causing these methods
parser:didStartElement:namespaceURI:qualifiedName:attributes:
parser:didEndElement:namespaceURI:qualifiedName:attributes:
to fire for the part of the following data:
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:NDFDgenResponse xmlns:ns1=""><dwmlOut xsi:type="xsd:string"><?xml version="1.0"?>
<dwml version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd">
(body excluded)
</dwml>
</dwmlOut></ns1:NDFDgenResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
I'm not an XML expert, but to me, the <dwml></dwml>
part looks like just a regular element, to be parsed just like the parts before it.
I do get two parser:parseErrorOccurred: errors, #200 and #201, but they occur during the parsing of the <SOAP-ENV:Body>
element, not the <dwml>
element, so I'm not sure if they are relevant. Thanks for any help you can give me.
Update: A friend of mine has told me offline of several errors in the data above. I can't understand why NOAA would be sending out malformed XML though -- is there some secret to parsing it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个 SOAP 网络服务,您可能想尝试一下:http://code.google.com /p/wsdl2objc/
This is a SOAP web service, you might want to try this: http://code.google.com/p/wsdl2objc/