Xpath query not working in Objective C using GdataXML
I am trying to parse an xml using GdataXML
I have a query which is not working and I wonder why:
<address_component>
<long_name>开发者_运维百科Mars</long_name>
<short_name>Mars</short_name>
<type>route</type>
</address_component>
I want to save the long_name where the type is route and I am using this query
/*[name() = 'address_component']
/*[name() = 'type' and text() = 'route']
/*[name() = 'long_name']
What am I doing wrong here?
===========
Is there a way for GDataXML to parse the xml line for line? is there a way other than running the xml a few times into an array?
I want to save the long_name where the type is route
This XPath expression should work:
/address_component[type='route']/long_name
Meanning: a long_name
element child of an address_component
root element having a type
child element with 'route'
string value.
精彩评论