2011-03-20 10 views
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> 

나는이 xml .. xpath를 사용하여 topic_title의 가치를 얻는 방법?객관적인 질문, xpath에 관한 질문

답변

1
/methodResponse 
    /params 
     /param 
     /value 
      /struct 
       /member[name='topic_title'] 
       /value 
        /string 
+1

는 NSString * 전기 = [[[파서 nodesForXPath @ "/ methodResponse를/PARAMS/PARAM/값/구조체/부재 [NAME = 'TOPIC_TITLE']/값/문자열"오류 : 닐] objectAtIndex : 0] stringValue]; – codereviewanskquestions

+0

이 모양이 괜찮습니까? – codereviewanskquestions

+0

@LCYSoft - 죄송합니다, Objective-C를 모르겠습니다. 예를 들어 다음과 같이 XPath 만 테스트 할 수 있습니다. http://www.xmlme.com/XpathTool.aspx –