You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been tracking down some problems with my implementation for XPath and I think it is not my problem, but yours. Let me explain. In Nokogiri::XML::NodeSet#search you can see:
each do |node|
paths.each do |path|
sub_set +=
send(path =~ /^(\.\/|\/)/ ? :xpath : :css, *(paths + [ns]))
end
end
Ok, for each node you're iterating over paths and, for each path, you're calling either the xpath or the css method of NodeSet. And guess what, both of them iterates over each node... again. You can take a look at search, xpath and css methods in Nokogiri::XML::NodeSet.
The easiest way to fix this is deleting lines 75 and 80.
Just to explain why this is happening, my implementation is based on RubyArray and I used the op_plus function in it. By the way, if you're implementation of the plus operator removes duplicates I see no difference between + and &, so I would like to know what should I do in the java impl.
The text was updated successfully, but these errors were encountered:
Hi there:
I've been tracking down some problems with my implementation for XPath and I think it is not my problem, but yours. Let me explain. In Nokogiri::XML::NodeSet#search you can see:
Ok, for each node you're iterating over paths and, for each path, you're calling either the xpath or the css method of NodeSet. And guess what, both of them iterates over each node... again. You can take a look at search, xpath and css methods in Nokogiri::XML::NodeSet.
The easiest way to fix this is deleting lines 75 and 80.
Just to explain why this is happening, my implementation is based on RubyArray and I used the op_plus function in it. By the way, if you're implementation of the plus operator removes duplicates I see no difference between + and &, so I would like to know what should I do in the java impl.
The text was updated successfully, but these errors were encountered: