Note that there are some explanatory texts on larger screens.

plurals
  1. POunable to parse xml using touchXML, nodesForXPath return nothing
    primarykey
    data
    text
    <p>I am trying to parse xml using the touchXML library but not getting the results, the code is as below </p> <pre><code>NSError *error = nil; CXMLDocument *xmlParser = [[CXMLDocument alloc] initWithXMLString:dataString options:0 error:&amp;error]; NSArray *resultNodes = NULL; resultNodes = [xmlParser nodesForXPath:@"//entry" error:&amp;error]; for (CXMLElement *resultElement in resultNodes) { NSMutableDictionary *blogItem = [[NSMutableDictionary alloc] init]; int counter; for(counter = 0; counter &lt; [resultElement childCount]; counter++) { [blogItem setObject:[[resultElement childAtIndex:counter] stringValue] forKey:[[resultElement childAtIndex:counter] name]]; } } </code></pre> <p>the method nodesForXPath: doesn't returns anything leaving the resultNodes array with 0 objects. I am getting the proper xml in dataString and the CXMLDocument is also getting prepared properly. I tried debugging it but there is nothing I can see accept the 0 objects in resultNodes, NSError also contains nothing (i.e. no error occurs). the xml file I am trying to parse is as below.</p> <pre><code>&lt;feed xmlns:s="http://syndication.nhschoices.nhs.uk/services" xmlns="http://www.w3.org/2005/Atom"&gt; &lt;title type="text"&gt;...&lt;/title&gt; &lt;id&gt;...&lt;/id&gt; &lt;rights type="text"&gt;© Crown Copyright 2009&lt;/rights&gt; &lt;updated&gt;2012-04-27T11:33:02+01:00&lt;/updated&gt; &lt;category term="Search"/&gt; &lt;logo&gt;...&lt;/logo&gt; &lt;author&gt;...&lt;/author&gt; &lt;s:SearchCoords&gt;174900,517900&lt;/s:SearchCoords&gt; &lt;entry&gt; &lt;id&gt; http://v1.syndication.nhschoices.nhs.uk/organisations/gppractices/32248 &lt;/id&gt; &lt;title type="text"&gt;Sayer A&lt;/title&gt; &lt;updated&gt;2012-04-27T10:33:02Z&lt;/updated&gt; &lt;link rel="self" title="Sayer A" href="http://v1.syndication.nhschoices.nhs.uk/organisations/gppractices/32248?apikey=YAHUGHET"/&gt; &lt;link rel="alternate" title="Sayer A" href="http://www.nhs.uk/ServiceDirectories/Pages/GP.aspx?pid=15F37AEF-EC5B-4A90-9E72-269ADEB39629"/&gt; &lt;content type="application/xml"&gt; &lt;s:organisationSummary&gt; &lt;s:name&gt;Sayer A&lt;/s:name&gt; &lt;s:address&gt; &lt;s:addressLine&gt;The Richmond Green Medical Cen&lt;/s:addressLine&gt; &lt;s:addressLine&gt;19 The Green&lt;/s:addressLine&gt; &lt;s:addressLine&gt;Richmond&lt;/s:addressLine&gt; &lt;s:addressLine&gt;Surrey&lt;/s:addressLine&gt; &lt;s:postcode&gt;TW91PX&lt;/s:postcode&gt; &lt;/s:address&gt; &lt;s:contact type="General"&gt; &lt;s:telephone&gt;020 83327515&lt;/s:telephone&gt; &lt;/s:contact&gt; &lt;s:geographicCoordinates&gt; &lt;s:northing&gt;174900&lt;/s:northing&gt; &lt;s:easting&gt;517800&lt;/s:easting&gt; &lt;s:longitude&gt;-0.305512266736965&lt;/s:longitude&gt; &lt;s:latitude&gt;51.4608026642546&lt;/s:latitude&gt; &lt;/s:geographicCoordinates&gt; &lt;s:Distance&gt;0.1&lt;/s:Distance&gt; &lt;/s:organisationSummary&gt; &lt;/content&gt; &lt;/entry&gt; &lt;entry&gt; &lt;id&gt; http://v1.syndication.nhschoices.nhs.uk/organisations/gppractices/33420 &lt;/id&gt; &lt;title type="text"&gt;Griffiths W&lt;/title&gt; &lt;updated&gt;2012-04-27T10:33:02Z&lt;/updated&gt; &lt;link rel="self" title="Griffiths W" href="http://v1.syndication.nhschoices.nhs.uk/organisations/gppractices/33420?apikey=YAHUGHET"/&gt; &lt;link rel="alternate" title="Griffiths W" href="http://www.nhs.uk/ServiceDirectories/Pages/GP.aspx?pid=EEC98A8A-B888-4F44-A0B6-DC6ABCBF19CE"/&gt; &lt;content type="application/xml"&gt; &lt;s:organisationSummary&gt; &lt;s:name&gt;Griffiths W&lt;/s:name&gt; &lt;s:address&gt; &lt;s:addressLine&gt;Paradise Road Surgery&lt;/s:addressLine&gt; &lt;s:addressLine&gt;37 Paradise Road&lt;/s:addressLine&gt; &lt;s:addressLine&gt;Richmond&lt;/s:addressLine&gt; &lt;s:addressLine&gt;Surrey&lt;/s:addressLine&gt; &lt;s:postcode&gt;TW91SA&lt;/s:postcode&gt; &lt;/s:address&gt; &lt;s:contact type="General"&gt; &lt;s:telephone&gt;020 89402423&lt;/s:telephone&gt; &lt;/s:contact&gt; &lt;s:geographicCoordinates&gt; &lt;s:northing&gt;174800&lt;/s:northing&gt; &lt;s:easting&gt;518100&lt;/s:easting&gt; &lt;s:longitude&gt;-0.301388352909701&lt;/s:longitude&gt; &lt;s:latitude&gt;51.4601120315006&lt;/s:latitude&gt; &lt;/s:geographicCoordinates&gt; &lt;s:Distance&gt;0.223606797749979&lt;/s:Distance&gt; &lt;/s:organisationSummary&gt; &lt;/content&gt; &lt;/entry&gt; &lt;entry&gt; &lt;id&gt; http://v1.syndication.nhschoices.nhs.uk/organisations/gppractices/33035 &lt;/id&gt; &lt;title type="text"&gt;Dr Da Costa&lt;/title&gt; &lt;updated&gt;2012-04-27T10:33:02Z&lt;/updated&gt; &lt;link rel="self" title="Dr Da Costa" href="http://v1.syndication.nhschoices.nhs.uk/organisations/gppractices/33035?apikey=YAHUGHET"/&gt; &lt;link rel="alternate" title="Dr Da Costa" href="http://www.nhs.uk/ServiceDirectories/Pages/GP.aspx?pid=EDCE215D-6412-4AAB-AFC4-9F37888D413C"/&gt; &lt;content type="application/xml"&gt; &lt;s:organisationSummary&gt; &lt;s:name&gt;Dr Da Costa&lt;/s:name&gt; &lt;s:address&gt; &lt;s:addressLine&gt;The Vineyard Surgery&lt;/s:addressLine&gt; &lt;s:addressLine&gt;35 The Vineyard&lt;/s:addressLine&gt; &lt;s:addressLine&gt;Richmond&lt;/s:addressLine&gt; &lt;s:addressLine&gt;Surrey&lt;/s:addressLine&gt; &lt;s:postcode&gt;TW106PP&lt;/s:postcode&gt; &lt;/s:address&gt; &lt;s:contact type="General"&gt; &lt;s:telephone&gt;020 89480404&lt;/s:telephone&gt; &lt;/s:contact&gt; &lt;s:geographicCoordinates&gt; &lt;s:northing&gt;174600&lt;/s:northing&gt; &lt;s:easting&gt;518100&lt;/s:easting&gt; &lt;s:longitude&gt;-0.301044685875553&lt;/s:longitude&gt; &lt;s:latitude&gt;51.4581333717098&lt;/s:latitude&gt; &lt;/s:geographicCoordinates&gt; &lt;s:Distance&gt;0.360555127546399&lt;/s:Distance&gt; &lt;/s:organisationSummary&gt; &lt;/content&gt; &lt;/entry&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload