XPath string function support using libxml2 (Kissxml and GDataxml)

soulhacker4013

New Member
I have been trying to perform the xpath 1.0 string function concat() using both the KissXML and GDataXml projects without success (always evaluates to no results). These are documented here in the W3C spec.Note that non-function xpath's are evaluated correctly.Can anyone confirm if string functions such as concat() substring() etc are supported using libxml2 and/or the XML projects above on the iOS platform? If not, is there any way at all to query an xml document on iOS using xpath string functions such as concat()? UPDATE:Below is a snippet of my testing using KissXML. My simple XML Structure is below. The goal is to concat the first and surnames.\[code\]<?xml version="1.0"?><entity> <properties> <keyValue> <key>firstname</key> <value>John</value> </keyValue> <keyValue> <key>surname</key> <value>Smith</value> </keyValue> </properties></entity>\[/code\]And source:\[code\]NSError *error;NSString *testData = http://stackoverflow.com/questions/11167557/@"<?xml version=\"1.0\"?><entity><properties><keyValue><key>firstname</key><value>John</value></keyValue><keyValue><key>surname</key><value>Smith</value></keyValue></properties></entity>"; DDXMLDocument *kDoc = [[DDXMLDocument alloc] initWithXMLString:testData options:0 error:&error]; NSArray *test = [kDoc nodesForXPath:@"concat(//keyValue[key='firstname']/value,//keyValue[key='surname']/value)" error:&error];\[/code\]I also tried a simple xpath with static strings as a simple function test:\[code\]NSArray *test = [kDoc nodesForXPath:@"concat('Hello', ' ', 'World')" error:&error];\[/code\]But this also fails to return any results.Thanks!
 
Back
Top