Re: Traversing an NSXML subtree

2009-05-28 Thread Justin Palmer
I had to do this recently. I needed to convert an NSXMLDocument to an NSDictionary. If you're interested, you can find the code on GitHub: http://github.com/Caged/aixmlserialize/blob/5322baec2f075d6f4f3bf9cab53b6a606c48ad76/src/AIXMLElementSerialize.m Justin Palmer http://alternateidea.com | ht

Re: Traversing an NSXML subtree

2009-05-28 Thread Graham Cox
On 29/05/2009, at 12:21 AM, Graham Cox wrote: makeObjectPerformSelector makeObjectsPerformSelector: ^ --G. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Conta

Re: Traversing an NSXML subtree

2009-05-28 Thread Graham Cox
On 28/05/2009, at 11:56 PM, McLaughlin, Michael P. wrote: Hello, I think you’re correct in what you show below. I was expecting that, since an XML document is already a tree, it would already have an equivalent to what you describe. I’ve reinvented the wheel too many times and now try

Re: Traversing an NSXML subtree

2009-05-28 Thread Graham Cox
On 28/05/2009, at 10:10 PM, McLaughlin, Michael P. wrote: Yes. I looked at that but 1. My tree is quite small (about 3 pages) and Xpath seemed like overkill. 2. Different objects will seek out information in different parts of the tree. That is, each will do a subtraversal once "their"

Re: Traversing an NSXML subtree

2009-05-28 Thread McLaughlin, Michael P.
On 5/27/09 5:02 PM, "Keith Duncan" wrote: >> Could someone clue me in as to the preferred method to do a >> subtraversal? > > Have you looked at XPath, it will save you from having to enumerate > and perform element-name string comparisons. > > Keith > Yes. I looked at that but 1. My tree is

Re: Traversing an NSXML subtree

2009-05-27 Thread Kyle Sluder
On Wed, May 27, 2009 at 2:16 PM, Greg Guerin wrote: > Recursion: Be careful if you're processing arbitrary XML documents; you only have 8MB of stack to work with by default, and each stack frame adds up quickly. You might need to turn your recursive solution into an iterative one. --Kyle Sluder

Re: Traversing an NSXML subtree

2009-05-27 Thread Greg Guerin
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 latte

Re: Traversing an NSXML subtree

2009-05-27 Thread Keith Duncan
Could someone clue me in as to the preferred method to do a subtraversal? Have you looked at XPath, it will save you from having to enumerate and perform element-name string comparisons. Keith ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com

Traversing an NSXML subtree

2009-05-27 Thread 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 o