Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting the value of an Element in Cocoa using TouchXML
    primarykey
    data
    text
    <p>I am using TouchXml because of the given limitations of NSXML on the actual iPhone. Anyway, I'm just starting out with Objective-C, I come from a C# background, and felt like learning something new..anyhow.. here is my xml file...</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FundInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/webservices"&gt; &lt;FundsReleaseDate&gt;2009-02-11T00:00:00&lt;/FundsReleaseDate&gt; &lt;FundValue&gt;7800&lt;/FundValue&gt; &lt;FundShares&gt;1000&lt;/FundShares&gt; &lt;/FundInfo&gt; </code></pre> <p>I'm trying to get 7800, i.e FundValue. Can someone point me in the correct direction, I am using the TouchXml CXMLDocument and myParser is of type CXMLDocument, I have tried</p> <pre><code>NSArray *nodes = [myParser nodesForXPath:@"//FundInfo" error:&amp;err]; </code></pre> <p>Basically nodes evaluates to nil </p> <pre><code>if ([nodes count] &gt; 0 ) { amount = [nodes objectAtIndex:1]; } </code></pre> <p>UPDATE 1: I have abandoned parsing using XPath, and have replaced it with NSURLRequest, so now I have the entire XML in a string, but my rude introduction to objective-C continues...I just realized how spoiled I have become to the .NET BCL where things like Regex are so easily available. </p> <p>UPDATE2: I've figured out how to use RegexKitLite for regex. </p> <p>So the question now is, how do I get the "7800" from inside FundValue which is now one big string. I have confirmed I have it in my NSString by writing it using NSLog.</p>
    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.
    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