Looking through the xpath code, there is a class XML::Node::Set that seems fairly pointless. It duplicates the functionality already provided in the XPath::Object class.

nodes = document.find('/header')
nodes.class == XPath::Object
nodes.first
nodes.length
nodes.each do |node|
 ..
end

And then...

node_set = nodes.set
node_set.class == XML::Node::Set
node.first
node.length
node.each do |node|
 ..
end


Seems better to re-purpose the XML::Node::Set to be used to return a node set when a user calls node.children (which now returns a node, which is fairly weird, although that is how libxml works).

If that doesn't make sense, then it should just be removed. XPath::Object#set could just return itself, calling code would be none the wiser since the API's are identical.

Charlie

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to