Class: Plurimath::XmlEngine::OxEngine
- Inherits:
-
Object
- Object
- Plurimath::XmlEngine::OxEngine
- Defined in:
- lib/plurimath/xml_engine/ox_engine.rb,
lib/plurimath/xml_engine/ox_engine/element.rb
Defined Under Namespace
Classes: Element
Class Method Summary collapse
- .dump(data, **options) ⇒ Object
- .is_xml_comment?(node) ⇒ Boolean
- .load(data) ⇒ Object
- .new_element(name) ⇒ Object
- .replace_nodes(root, nodes) ⇒ Object
Class Method Details
.dump(data, **options) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/plurimath/xml_engine/ox_engine.rb', line 14 def dump(data, **) # XML 1.0 cannot represent C0 controls other than tab, newline and # carriage return. Drop them rather than emit a document a conforming # parser rejects; last wins, so a caller cannot reinstate them. ::Ox.dump(data.xml_nodes, **, invalid_replace: "") end |
.is_xml_comment?(node) ⇒ Boolean
27 28 29 30 31 |
# File 'lib/plurimath/xml_engine/ox_engine.rb', line 27 def is_xml_comment?(node) return node.is_xml_comment? if node.is_a?(Element) false end |
.load(data) ⇒ Object
21 22 23 24 25 |
# File 'lib/plurimath/xml_engine/ox_engine.rb', line 21 def load(data) Element.new( ::Ox.load(data, strip_namespace: true), ) end |
.new_element(name) ⇒ Object
10 11 12 |
# File 'lib/plurimath/xml_engine/ox_engine.rb', line 10 def new_element(name) Element.new(name) end |
.replace_nodes(root, nodes) ⇒ Object
33 34 35 36 |
# File 'lib/plurimath/xml_engine/ox_engine.rb', line 33 def replace_nodes(root, nodes) root.replace_nodes(Array(nodes)) root end |