2

I have following xml mutableData.

<responce xmlns:xsi="http://.." xmlns:xsd="http://..." xmlns="http://...">
  <Succeeded id="0">
    <uri>userName</uri>
    <signatureData>PdppDDD8388OPDJJD==</signatureData>
  </Succeeded>
</responce>

And I have written following line of code for parsing the above xml string.

CXMLDocument *doc=[[CXMLDocument alloc]initWithData:responseData options:0 error:nil];
NSArray *nodes=nil;
nodes=[doc nodesForXPath:@"//signatureData" error:nil];

Here responceData is holding above xml string. I have to find signatureData value. But it is sending 0 object in nodes array. What is wrong with the code?

Woody
  • 5,052
  • 2
  • 22
  • 28
Ajay_Kumar
  • 1,381
  • 10
  • 34
  • 62
  • Are the spaces after the opening braces in your XML a formatting error on the site? If it is not, note that spaces are not legal XML so wouldn't be parsed by anything – Woody Jul 10 '12 at 09:06
  • There is no space, I am not able to paste xml tag on stackoverflow that'w why I have given space. In my xml no any space is there. – Ajay_Kumar Jul 10 '12 at 10:07
  • You can paste xml fine here, I do it all the time. Fixed for you, is that right? – Woody Jul 10 '12 at 11:13
  • Have you parsed by the touchXML code reference which I have written above? The same code is saying an error [CXMLNode nodeWithLibXMLNode:]: unrecognized selector sent... – Ajay_Kumar Jul 10 '12 at 11:55
  • Options are 1) add NSError *error = nil; and send that in error to see if it is returning an error. 2) use an xpath of / and see if it returns anything at all, to check your data is right in the first place – Woody Jul 10 '12 at 12:35
  • Have you found any solution? – Saqib Saud Dec 13 '12 at 12:03
  • You need to edit your xpath to nodes=[doc nodesForXPath:@"//Succeeded" error:nil]; – Gajendra K Chauhan Dec 11 '13 at 06:22

0 Answers0