开发者

NSXMLParser ignores element named <id>

开发者 https://www.devze.com 2022-12-12 04:17 出处:网络
I\'m using Wordpress\'s XML-RPC framework in my project. Now I havea situation where in the XML response there is a tag namedwhich contains user data and by the time the response has been parsed and r

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 alwa开发者_运维技巧ys a sensitive word but still...


Turns out this is the problem:

http://ws.apache.org/xmlrpc/faq.html#string_format

0

精彩评论

暂无评论...
验证码 换一张
取 消