Hello,
I am new to objective c. I am right now working on the web service based application.I am using .net webservice that i would like to point out.
The thing is that using XML code,i am able to fetch the XML string in a simple string variable,but i cant get how to get data from the same in different variable.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetDetailResponse xmlns="http://tempuri.org/">
<GetDetailResult>{"TimeRemaining":"0 days 0 Hrs 0Mins","Rank":"0","Marks":"0","ContractsHeld":"0","CurrentLocation":"London","CurrentLatitude":23.056989,"CurrentLongitude":72.565384}</GetDetailResult>
</GetDetailResponse>
</soap:Body>
</soap:Envelope>
The above given is my xml string,that i am able to fetch in a string.now if i want to say fetch data of say CurrentLongitude in some variable,what should i do?
I tried the code :
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
currElement = [elementName copy];
if ([elementName isEqualToString:@"Location"])
{
txt1.text = [[NSMutableString alloc]init];
}
else if([elementName isEqualToString:@"TimeRemaining"])
{
txt1.text = [[NSMutableString alloc]init];
}
}
but it results into "soap:Envelope" variable elementName.How should i fetch CurrentLocation or some other variable?
Kindly help me out.
Thank you.