Parsing an Xml using Soap Web Services
i am trying to parse an xml file that i receive from a web service using the tutorial Soap Tutorial
..
i initialize the data received to a NSString as follows
NSString *theXML = [[NSString alloc]
initWithBytes: [webData mutableBytes]
length:[webData length]
encoding:NSUTF8StringEncoding];
`
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetCategoryResponse xmlns="http://tempuri.org/">
<GetCategoryResult>
<Root><Record><catid>1</catid><catname>Hi</catname><catlogo>http://10.25.4.49/monsoonstore/Category/50X50.GIF</catlogo></Record></Root&开发者_开发百科gt;</GetCategoryResult>
</GetCategoryResponse>
</s:Body>
</s:Envelope>
when i parse the data my parser doesn't read the ROOT tag as it should but instead starts with the envelope tag.. how can i get the parser to parse the exact xml that i receive from the server i.e
<Root><Record><catid>1</catid><catname>Hi</catname><catlogo>http://10.25.4.49/monsoonstore/Category/50X50.GIF</catlogo></Record></Root>
how can i parse this webData with te correct tags??
you may use the TouchXML parser to get better and desired results, and then use in XML parser function
NSString *responseString = [[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding] autorelease];
CXMLDocument *xmlParser = [[[CXMLDocument alloc] initWithXMLString:responseString options:0 error:nil] autorelease];
NSArray *returnNodes = NULL;
returnNodes = [xmlParser nodesForXPath:@"//Root" error:nil];
.
.
.
精彩评论