NSXMLParser 忽略名为的元素
我在我的项目中使用 Wordpress 的 XML-RPC 框架。现在我遇到的情况是,在 XML 响应中有一个名为 的标签,其中包含用户数据,并且当响应被解析并以某种数组格式返回时,该标签及其值已经消失。我已将其追溯到 NSXMLParser 的解析方法。任何人都知道发生了什么事,为什么解析器会吃掉 id 元素?
响应是:
<?xml version="1.0" encoding="UTF-8">
<methodResponse>
<params>
<param>
<value>
<array>
<data>
<value>
<struct>
<member>
<name>id</name>
<value>2009-10-01Demo</value>
</member>
<member>
<name>distance</name>
<value>
<double>3.0</double>
</value>
</member>
<member>
<name>fuel</name>
<value>
<double>5.199999809265137</double>
</value>
</member>
<member>
<name>cost</name>
<value>
<double>8.199999809265137</double>
</value>
</member>
<member>
<name>begin</name>
<value>
<dateTime.iso8601>20091011T12:30:11</dateTime.iso8601>
</value>
</member>
</struct>
</value>
</data>
</array>
</value>
</param>
</params>
</methodResponse>
2009-11-16 16:20:26.943 ProjectName[2102:207]
解码值:
(
{
begin = 2009-10-11 12:30:11 -0700;
cost = 8.2;
distance = 3;
fuel = 5.2;
}
)
我意识到 id 始终是敏感词,但仍然......
I'm using Wordpress's XML-RPC framework in my project. Now I have a situation where in the XML response there is a tag named which contains user data and by the time the response has been parsed and returned as some array format, that tag and it's value are gone. I have traced this down to NSXMLParser's parse method. Anyone know what's going on, why does the parser eat the id element?
Response is:
<?xml version="1.0" encoding="UTF-8">
<methodResponse>
<params>
<param>
<value>
<array>
<data>
<value>
<struct>
<member>
<name>id</name>
<value>2009-10-01Demo</value>
</member>
<member>
<name>distance</name>
<value>
<double>3.0</double>
</value>
</member>
<member>
<name>fuel</name>
<value>
<double>5.199999809265137</double>
</value>
</member>
<member>
<name>cost</name>
<value>
<double>8.199999809265137</double>
</value>
</member>
<member>
<name>begin</name>
<value>
<dateTime.iso8601>20091011T12:30:11</dateTime.iso8601>
</value>
</member>
</struct>
</value>
</data>
</array>
</value>
</param>
</params>
</methodResponse>
2009-11-16 16:20:26.943 ProjectName[2102:207]
Decoded value:
(
{
begin = 2009-10-11 12:30:11 -0700;
cost = 8.2;
distance = 3;
fuel = 5.2;
}
)
I realize that id is always a sensitive word but still...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原来这就是问题所在:
http://ws.apache.org/xmlrpc/faq .html#string_format
Turns out this is the problem:
http://ws.apache.org/xmlrpc/faq.html#string_format