In all cases, html can be a string or an IO object (something that
responds to #read). The url parameter is entirely for error reporting,
as in Nokogiri. The encoding parameter only signals what encoding html
should have on input; the output Document or DocumentFragment will be in
UTF-8. Currently, the only options supported is :max_errors which controls
the maximum number of reported by #errors.
The goal is to eventually implement proper serialization and XML
namespaces on foreign elements.
This changes the top-level API to more closely match Nokogiri's while maintaining backwards compatibility. The new APIs are
Nokogiri::HTML5(html, url = nil, encoding = nil, **options, &block)
Nokogiri::HTML5.parse(html, url = nil, encoding = nil, **options, &block)
Nokogiri::HTML5::Document.parse(html, url = nil, encoding = nil, **options, &block)
Nokogiri::HTML5.fragment(html, encoding = nil, **options)
Nokogiri::HTML5::DocumentFragment.parse(html, encoding = nil, **options)
In all cases,
html
can be a string or anIO
object (something that responds to#read
). Theurl
parameter is entirely for error reporting, as in Nokogiri. Theencoding
parameter only signals what encodinghtml
should have on input; the outputDocument
orDocumentFragment
will be in UTF-8. Currently, the only options supported is:max_errors
which controls the maximum number of reported by#errors
.The goal is to eventually implement proper serialization and XML namespaces on foreign elements.