NSXMLParser 实体问题
我有一个返回以下内容的 .NET Web 服务:
<ArrayOfAddressLocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<AddressLocation>
<AddressLocationId>0</AddressLocationId>
<SubscribedCount>0</SubscribedCount>
<City>Florida A & M</City>
<CountryStateName>Florida</CountryStateName>
<CountryName>United States</CountryName>
</AddressLocation>
</ArrayOfAddressLocation>
我正在尝试解析每个位置的城市节点,但是,我在控制台中的 &
之后出现换行符:
//2010-09-28 11:14:02.121 Appt Pal[8296:207] Florida A
//2010-09-28 11:14:02.121 Appt Pal[8296:207] &
//2010-09-28 11:14:02.121 Appt Pal[8296:207] M
我不明白的是 &
是有效的 XML,但它不维护节点的值...
I have a .NET web service that is returning the following:
<ArrayOfAddressLocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<AddressLocation>
<AddressLocationId>0</AddressLocationId>
<SubscribedCount>0</SubscribedCount>
<City>Florida A & M</City>
<CountryStateName>Florida</CountryStateName>
<CountryName>United States</CountryName>
</AddressLocation>
</ArrayOfAddressLocation>
I am trying to parse out the city node of this for each location, however, I am getting a line break after the &
in the console:
//2010-09-28 11:14:02.121 Appt Pal[8296:207] Florida A
//2010-09-28 11:14:02.121 Appt Pal[8296:207] &
//2010-09-28 11:14:02.121 Appt Pal[8296:207] M
What I don't understand is that the &
is valid XML, but it is not maintaining the node's value...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解析器发送
parser:foundCharacters:
消息三次。如果将日志语句移至parser:didEndElement:namespaceURI:qualifiedName:
委托方法,您将看到整个字符串,没有由NSLog
函数添加的换行符。The parser is sending the
parser:foundCharacters:
message three times. If you move your log statement to theparser:didEndElement:namespaceURI:qualifiedName:
delegate method, you will see the entire string without the line breaks that are added by theNSLog
function.