开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜