I have an xml I am using TouchXML to parse it. Basically, a Lookup looks like this:
<Lookup>
<LookupID>201150103538705</LookupID>
<LookupName />
<LookupType>Category</LookupType>
<VendorID>10</VendorID>
</Lookup>
When I do this, it returns all Lookup in the document:
NSArray *lookups = [[xmlDoc rootElement] nodesForXPath:@"//TestA:Lookup"
namespaceMappings:mappings
error:nil];
What I want to do is get all lookups whos LookupType is equal to Composition (string compare). So this is what’s I have tried and it returns null:
NSArray *lookups = [[xmlDoc rootElement] nodesForXPath:@"//TestA:Lookup[LookupType=\"Composition\"]"
namespaceMappings:mappings
error:nil];
Thanks
Does the XPath
//TestA:Lookup[TestA:LookupType='Composition']do what you want? If the parent element is in a namespace then its child too so I think you need a prefix on both elements in your path.