tenderlove/nokogiri — Issue #551: Parsing without NOENT still substitutes entities
Author: Phrogz
Created: 2011-10-13 20:34:33+00:00
State: open

require 'nokogiri'
p Nokogiri::VERSION
#=> "1.5.0"
p [
Nokogiri::XML::ParseOptions::NOENT,
Nokogiri::XML::ParseOptions::DEFAULT_HTML
].map{ |o| Nokogiri::HTML("

Foo®

",nil,'utf-8',o).at('//text()') }
#=> [#,
#=> #]

I expected a Nokogiri::XML::EntityReference to be created for those characters that are specified by an entity, e.g.

require 'nokogiri'
doc = Nokogiri::HTML("

Foo

")
doc.at('p') << Nokogiri::XML::EntityReference.new( doc, 'reg' )
p doc.at('p').children
#=> [#,
#=> #]

Originated by trying to answer [this Stack Overflow question](http://stackoverflow.com/questions/7756123/nokogiri-leaving-html-entities-untouched/7759975#7759975).