On Thursday, May 10, 2012 10:28:24 AM UTC-5, Loren Cahlander wrote:
> I am having a similar problem.
> Here is a sample of the data that returns from the webservice call:
> <?xml version="1.0" encoding="utf-8"?>
> <IndividualMAPPResults xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://xml.assessment.com/Service/MAPPResults">
> <MAPP_Member>
> <MemberID>1234567890</MemberID>
> <FirstName>John</FirstName>
> <MiddleInitial/>
> <LastName>Doe</LastName>
> <Email>john....@example.com</Email>
> <ErrorCode>0</ErrorCode>
> </MAPP_Member>
> </IndividualMAPPResults>
> Here is my code:
> NSLog(@"DONE. Received Bytes: %d", [self.webdata length]);
> NSString *theXML = [[NSString alloc]
> initWithBytes: [self.webdata mutableBytes]
> length:[self.webdata length]
> encoding:NSUTF8StringEncoding];
> //---shows the XML---
> NSLog(@"%@", theXML);
> NSError *err = nil;
> DDXMLDocument *document = [[DDXMLDocument alloc] initWithXMLString:theXML
> options:0 error:&err];
> DDXMLElement *rootElement = [document rootElement];
> NSArray *docs=[rootElement nodesForXPath:@"//FirstName" error:&err];
> NSLog(@"Doc Count %i",[docs count]);
> for (DDXMLElement *documents in docs)
> {
> NSLog(@"First Name: %@", [documents stringValue]);
> }
> I should get back an array of 1 element and it should contain "John"
> Thank you,
> Loren