Re: Accessing attributes of XML
Re: Accessing attributes of XML
- Subject: Re: Accessing attributes of XML
- From: Jens Alfke <email@hidden>
- Date: Mon, 5 May 2008 09:28:46 -0700
On 5 May '08, at 5:34 AM, Christian Graus wrote:
NSXMLElement *node2 = [array objectAtIndex:nodeCount];
NSXMLElement *name = [node2 attributeForName:@"Name"];
'name' should be declared as NSXMLNode*, or you'll get a compiler type-
mismatch warning. (But that doesn't explain why its -stringValue would
be nil.) Try setting a breakpoint after this line in the debugger,
then in the debug console enter "po name" and it should print the XML
corresponding to that node*.
I cannot work out how to access the inner Text of the node
[node2 stringValue]. (NSXMLElement inherits that from NSXMLNode.)
The attributes collection should be 15 odd objects, and it's 0.
Hm, I don't see why that wouldn't work. Again, at your breakpoint type
"po node2" and see what XML it contains; you might not have gotten the
element you expected.
—Jens
* The 'po' (Print Object) command is your friend. It calls -
description on the object you give it and prints the result, so it's a
great way to look at the values of Obj-C objects.Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden