Re: Traversing an NSXML subtree
Re: Traversing an NSXML subtree
- Subject: Re: Traversing an NSXML subtree
- From: Greg Guerin <email@hidden>
- Date: Wed, 27 May 2009 14:16:35 -0700
McLaughlin, Michael P.:
In reviewing the NSXML documents, I found no really simple way to
traverse a
subtree of an NSXMLDocument. That is, traverse from the root until
you hit
the node with the right name then pretend that that node is the
root of a
smaller tree and traverse just the latter. [Everything I found
talked only
about sibs and (immediate) children, not grandchildren, etc.]
Since this is such a common thing to do, I'm guessing that I must have
misread the docs somehow.
Could someone clue me in as to the preferred method to do a
subtraversal?
Recursion:
http://en.wikipedia.org/wiki/Recursion
Given any NSXMLNode, if it has children, you can traverse the
children. Since each child is itself an NSXMLNode, the "Given any
NSXMLNode..." sentence at the begining of this paragraph applies.
The previous two sentences are recursive.
Start recursion at the root node of the NSXMLDocument.
-- GG
_______________________________________________
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