1
<methodResponse>
    <params>
        <param>
            <value>
                <struct>
                    <member>
                        <name>topic_id</name>
                        <value>
                            <string>102</string>
                        </value>
                    </member>
                    <member>
                        <name>topic_title</name>
                        <value>
                            <string>Login test</string>
                        </value>
                    </member>
                </struct>
            </value>
        </param>
    </params>
</methodResponse>

I have this xml.. How to get the value of topic_title using xpath?

codereviewanskquestions
  • 13,460
  • 29
  • 98
  • 167

1 Answers1

1
/methodResponse
   /params
      /param
         /value
            /struct
              /member[name='topic_title']
                 /value
                    /string
Wayne
  • 59,728
  • 15
  • 131
  • 126
  • 1
    NSString *postings = [[[parser nodesForXPath:@"/methodResponse/params/param/value/struct/member[name='topic_title']/value/string" error:nil] objectAtIndex:0] stringValue]; – codereviewanskquestions Mar 20 '11 at 23:45
  • @LCYSoft - Sorry, I don't know Objective-C. I can only provide the XPath, which you can test, for example, here: http://www.xmlme.com/XpathTool.aspx – Wayne Mar 20 '11 at 23:51