Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>xmlDocument = [[GDataXMLDocument alloc] initWithXMLString:responseString options:0 error:&amp;errorOnStore]; if (nil == xmlDocument) { NSLog(@"could not load xml file"); } else { NSLog(@"Loading desire xml"); NSLog(@"%@", xmlDocument.rootElement); // skip this bits, you're trying to retrieve wrong element //NSArray *getData = [[xmlDocument rootElement] elementsForName:@"SiteStats"]; //NSLog(@"%@",getData); records = [[NSMutableArray alloc] init]; //[records retain]; //if(getData.count !=0 ) //{ //NSLog(@"data has"); //} //storing the car model in the mutable array //for(GDataXMLElement *e in getData) //{ //NSLog(@"Enering in the xml file"); //[records addObject:e]; NSString *Visitor = [[[xmlDocument.rootElement elementsForName:@"visitor"] objectAtIndex:0] stringValue]; NSLog(@"Visitor : %@",Visitor); NSString *UVisitor = [[[xmlDocument.rootElement elementsForName:@"uniqueVisitor"] objectAtIndex:0] stringValue]; NSLog(@"Unique Visitor : %@",UVisitor); //} } </code></pre> <p>EDIT: <code>NSArray *getData = [[xmlDocument rootElement] elementsForName:@"SiteStats"];</code> in this line, you're trying to retrieve wrong element, element "SiteStats" is already the root element, so when you do that bit of code, what you're trying to do is looking for "SiteStats" inside of "SideStats" </p> <pre><code>&lt;SiteStats&gt; &lt;SiteStats&gt; &lt;visitor&gt;1&lt;/visitor&gt; &lt;uniqueVisitor&gt;1&lt;/uniqueVisitor&gt; &lt;orderCount&gt;0&lt;/orderCount&gt; &lt;revenue&gt;null&lt;/revenue&gt; &lt;conversionRate&gt;0&lt;/conversionRate&gt; &lt;newProduct&gt;3&lt;/newProduct&gt; &lt;outOfStockProduct&gt;0&lt;/outOfStockProduct&gt; &lt;/SiteStats&gt; &lt;/SiteStats&gt; </code></pre> <p>Your orignal code is likely to work if your XML looks something like above</p>
 

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