-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
equivalent-xml ignores unescaped XML entities. Try with this spec:
it "should detect xml entities" do
doc1 = "<doc xmlns='foo:bar'><first order='1'>Sam & Max</first><second>things</second></doc>"
doc2 = "<doc xmlns='foo:bar'><first order='1'>Sam Max</first><second>things</second></doc>"
expect(doc1).not_to be_equivalent_to(doc2)
endThat fails because Nokogiri is not configured with STRICT or NOENT options (see here)
I'm not sure what would be the most appropriate behaviour. Using STRICT would break other specs, like the one where you're comparing HTML:
context "(on fragments consisting of multiple nodes)" do
it "should compare all nodes" do
doc1 = "<h1>Headline</h1><h1>Headline</h1>"
doc2 = "<h1>Headline</h1><h2>Headline2</h2>"
expect(doc1).not_to be_equivalent_to(doc2)
end
endSo if you need equivalient-xml to handle invalid XML strings, you're left with NOENT. Unfortunately, I don't see any way to use parsing options with Nokogiri::XML#fragment (here), that's why I haven't opened a PR, sorry.
Metadata
Metadata
Assignees
Labels
No labels