This still uses a stack but at least no longer relies on the call stack. I decided not to go with the Morris in-order algorithm [1] as it modifies the tree during a search. This would not work well if a document were to be accessed from multiple threads at once (which should be possible for read-only operations). I might change this method to actually perform a search (opposed to just returning everything). This will require some closer inspection of the available XPath axes to determine if this is needed. Tests will also be added once I've taken care of the above. [1]: http://en.wikipedia.org/wiki/Tree_traversal#Morris_in-order_traversal_using_threading |
||
---|---|---|
.. | ||
oga | ||
oga.rb |