Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS CXMLElement StringValue
    primarykey
    data
    text
    <p>I'm trying to parse an xml here and am getting my CXMLElement properly. One, for example, logs this</p> <pre><code>&lt;CXMLElement 0x1d8cfdc0 [0x1c556660] TrackDetail &lt;TrackDetail&gt;Tracked&lt;/TrackDetail&gt;&gt; </code></pre> <p>but I can't get the string value, in this case <code>Tracked</code>. I've tried</p> <pre><code>CXMLNode *title = [[fd objectAtIndex:indexPath.row] nodeForXPath:@"TrackDetail" error:nil]; </code></pre> <p>but logging this returns <code>null</code>. Anyone know how to get the stringValue of a CXMLElement?</p> <p>Heres the example xml</p> <pre><code>&lt;TrackResponse&gt; &lt;TrackInfo ID="9400110200793563195827"&gt; &lt;TrackSummary&gt; The delivery status for this item has not been updated as of February 07, 2013, 11:34 pm. &lt;/TrackSummary&gt; &lt;TrackDetail&gt; Out for Delivery, February 07, 2013, 9:34 am, MASSAPEQUA, NY 11758 &lt;/TrackDetail&gt; &lt;TrackDetail&gt; Sorting Complete, February 07, 2013, 9:24 am, MASSAPEQUA, NY 11758 &lt;/TrackDetail&gt; &lt;TrackDetail&gt; Arrival at Post Office, February 07, 2013, 6:00 am, MASSAPEQUA, NY 11758 &lt;/TrackDetail&gt; &lt;TrackDetail&gt; Depart USPS Sort Facility, February 05, 2013, GRAND FORKS, ND 58201 &lt;/TrackDetail&gt; &lt;TrackDetail&gt; Processed at USPS Origin Sort Facility, February 04, 2013, 7:13 pm, GRAND FORKS, ND 58201 &lt;/TrackDetail&gt; &lt;TrackDetail&gt; Accepted at USPS Origin Sort Facility, February 04, 2013, 5:58 pm, EAST GRAND FORKS, MN 56721 &lt;/TrackDetail&gt; &lt;TrackDetail&gt; Electronic Shipping Info Received, February 04, 2013 &lt;/TrackDetail&gt; &lt;TrackDetail&gt; Shipment Accepted, February 04, 2013, 2:19 pm, EAST GRAND FORKS, MN 56721 &lt;/TrackDetail&gt; &lt;/TrackInfo&gt; &lt;/TrackResponse&gt; </code></pre> <p>and I parse it using this</p> <pre><code>NSArray *arr = [parser nodesForXPath:@"//TrackResponse/TrackInfo/TrackSummary" error:nil]; NSArray *p = [parser nodesForXPath:@"//TrackResponse/TrackInfo" error:nil]; if ([p count]&gt;0) { for (CXMLElement *resultElement in p) { for(int counter = 0; counter &lt; [resultElement childCount]; counter++) { NSLog(@"%@", [[[resultElement nodesForXPath:@"TrackDetail" error:nil] objectAtIndex:counter] stringValue]); [self.arr1 setObject:[[[resultElement nodesForXPath:@"TrackDetail" error:nil] objectAtIndex:counter] stringValue] forKey:@"det"]; } } } </code></pre>
    singulars
    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