[Nokogiri-talk] assume the position
phlip2005 at gmail.com
Tue Mar 10 23:52:20 EDT 2009
Given a Nokogiri::XML::Node, how do I detect its relative position among its
parent's children? Should I just look for it among its parent's children?
And how do I detect its absolute position within the DOM? Should I start at the
root and do depth-first in-order traversal, counting, until I find it?
I will do those things, yet it seems that I'm replicating XPath's position()
function, so if there's a simpler way...
I'm also open to alternate suggestions for my ulterior algorithm here. I'm
trying to upgrade http://gist.github.com/76136 so it complains if your HTML puts
nodes in a different order than your spec...
More information about the Nokogiri-talk