xml 응답을 포함하는 문자열이 있습니다 (asmx 웹 서비스) xml을 APXML 라이브러리를 통해 구문 분석합니다. 내가 body 태그를주고 루트 요소를 얻을 때 body 태그를 원하지 않는다. 루트 태그와 자식 태그보다 실제 데이터를 얻고 싶다 .. 이 데이터를 얻는 방법을 알려주세요 .. thanks .. 내 XML은 iPhone에서 XML을 구문 분석하는 방법
<?xml version="1.0" encoding="UTF-8" ?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<loginFunctionResponse xmlns="http://tempuri.org/">
<loginFunctionResult>
<Root xmlns="">
<child>
<id>52</id>
<name>mohsin</name>
</child>
</Root>
</loginFunctionResult>
</loginFunctionResponse>
</soap:Body>
</soap:Envelope>
이며, 내 코드는 ... 내가이 결과를 제공
NSString *resultString=[[NSString alloc] initWithBytes:[resultData bytes] length:resultData.length encoding:NSUTF8StringEncoding];
NSLog(@"result string: %@",resultString);
APDocument *doc = [APDocument documentWithXMLString:resultString];
APElement *rootElement = [doc rootElement];
NSArray *childElement = [rootElement childElements];
for (APElement *chile in childElement) {
NSLog(@"chid name %@",chile.name);
NSLog(@"chile value %@",chile.value);
}
..
chid name soap:Body
chile value (null)
XML 요소에는 값이없고 단순히 다른 자식이 있습니다. – borrrden
하위 태그 요소를 가져 오는 방법은 무엇입니까? 감사합니다 –
당신은 spoonfed 필요합니까? 루트 요소에서 하위 요소를 얻은 방법을 살펴보고 해당 논리를 적용하십시오. – borrrden