equivalent-xml
equivalent-xml copied to clipboard
Added test "It is able to ignore nodes with xmlns attribute set"
When I compare two nodes which have set "xmlns" attribute, and ignoring them, they should be equal.
This bug may relate to line path = path.gsub(/xmlns:/, ' :') unless Nokogiri.uses_libxml? in https://github.com/sparklemotion/nokogiri/blob/master/lib/nokogiri/xml/node.rb#L153
In the console, when I run:
> Nokogiri::XML('<a xmlns=""></a>').xpath("a")
=> [#<Nokogiri::XML::Element:0x385e name="a">]
but:
> Nokogiri::XML('<a xmlns=""></a>').css("a")
Nokogiri::XML::XPath::SyntaxError: // :a
from nokogiri/XmlXpathContext.java:123:in `evaluate'
The css method is called at https://github.com/mbklein/equivalent-xml/blob/master/lib/equivalent-xml.rb#L188
It is a nokogiri bug, but it would be nice if ignoring_content_of() allowed also xpath queries. I propose using search() instead of css()