Module: Canon::XmlBackend
- Defined in:
- lib/canon/xml_backend.rb
Overview
Selection of the XML engine.
Two independent concerns, deliberately separated (MECE):
- XML engine — :nokogiri (raw) or :moxml (adapter-mediated). Drives DOM parsing and serialization of XML (see Canon::XmlParsing).
- HTML support — always Nokogiri on CRuby; moxml has no HTML adapter and leptris no HTML parser (see Canon::Html::NokogiriSupport).
SSOT: moxml owns adapter preference (Moxml::Config prefers leptris when installed; see XmlParsing.moxml_adapter_name). Both engines follow the resolved adapter: SAX since leptris#625/#99 were fixed, DOM since moxml#143's materialize_fields stream (zero-allocation flat buffers) made the conversion competitive. Conformance parity is complete (engine_parity_spec 12/12). CANON_XML_BACKEND forces either engine; the CI performance gate is the standing referee.
HTML stays on Nokogiri on CRuby (Canon::Html::NokogiriSupport) and the pretty-printers keep the Nokogiri pipeline — pretty-printed bytes are canon's product (moxml#129).
Constant Summary collapse
- VALID_BACKENDS =
%i[nokogiri moxml].freeze
Class Method Summary collapse
Class Method Details
.active ⇒ Object
27 28 29 |
# File 'lib/canon/xml_backend.rb', line 27 def active @active ||= forced || detect end |
.moxml? ⇒ Boolean
35 36 37 |
# File 'lib/canon/xml_backend.rb', line 35 def moxml? active == :moxml end |
.nokogiri? ⇒ Boolean
31 32 33 |
# File 'lib/canon/xml_backend.rb', line 31 def nokogiri? active == :nokogiri end |
.reset! ⇒ Object
39 40 41 |
# File 'lib/canon/xml_backend.rb', line 39 def reset! @active = nil end |