开发者

Parsing partial XML created with SudzC in objective-c

Hello to all in this lovely community,

I am trying to get the contents of the data that is returned with a SudzC method from my web service. The w开发者_StackOverflow社区ebservice sends the data in a kind of partial XML like this:

<gUser>
 <user USERID="224" USERNAME="name" USERSURNAME="surname" PASSWORD="123" TELEPHONE="+123" EMAIL="" USERTYPE="2"></user>
</gUser>

This is returned as (id) in the SudzC method. It can be assigned to a dictionary, string and it can be printed with NSLog etc. However, I was not able to get what I need; the attributes of USERID, USERNAME and so on.

EDIT The result is of type NSCFString. It contains the whole XML data I wrote above in one string object. I tried to call a parser method that takes an NSString* obj(in this case, the result) as parameter, it gives the unrecognized selector exception. How am I going to parse/use this data if I can't divide the whole into pieces.

How should I proceed? Any help is much appreciated.

Regards,

Besel


According to the documentation for sudzc each element returned has a method called -attributes that contains all of that element's attributes as an array of nodes. You'll then have to iterate through that array to find the attributes you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜