0

I'm having difficulties parsing this xml with TBXML in iOS :

<ServiceResponse><Response> <Object type="java.lang.Integer">168</Object> </Response> <Exception/> </ServiceResponse>

I want to extract the "168" but I only achieve to extract the "java.lang.Integer"

Thanks for your help

Romain
  • 151
  • 1
  • 12
  • I can't see the code right now but I've only tried the "[TBXML elementName:element] isEqualToString:@"Object"]" ... I've the read the TBXML guide but it's not really helping – Romain Sep 13 '13 at 09:34

1 Answers1

2

TBXML have valueOfAttributeNamed method which is used to get attribute values and textForElement method which is used to get element values.

So do like this.

if ([[TBXML elementName:objElement] isEqualToString:@"Object"])
{
    NSLog(@"%@",[TBXML textForElement:objElement]) ;
}

instead of

[TBXML valueOfAttributeNamed:@"type" forElement:objElement]
wesley
  • 859
  • 5
  • 15