Class: Nokogiri::XML::Node
- Inherits:
-
Object
- Object
- Nokogiri::XML::Node
- Defined in:
- lib/rdf/xsd/extensions.rb
Overview
XML Exclusive Canonicalization (c14n) for Nokogiri.
Classes mixin this module to implement canonicalization methods.
This implementation acts in two parts, first to canonicalize the Node or NoteSet in the context of its containing document, and second to serialize to a lexical representation.
Instance Method Summary collapse
-
#c14nxl(options = {}) ⇒ Object
Canonicalize the Node.
-
#to_s_with_c14nxl ⇒ Object
(also: #to_s)
Serialize a canonicalized Node or NodeSet to XML.
Instance Method Details
#c14nxl(options = {}) ⇒ Object
Canonicalize the Node. Return a new instance of this node which is canonicalized and marked as such
29 30 31 32 |
# File 'lib/rdf/xsd/extensions.rb', line 29 def c14nxl( = {}) @c14nxl = true self end |
#to_s_with_c14nxl ⇒ Object Also known as: to_s
Serialize a canonicalized Node or NodeSet to XML
Override standard #to_s implementation to output in c14n representation if the Node or NodeSet is marked as having been canonicalized
39 40 41 42 43 44 45 |
# File 'lib/rdf/xsd/extensions.rb', line 39 def to_s_with_c14nxl if instance_variable_defined?(:@c14nxl) serialize(:save_with => ::Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS) else to_s_without_c14nxl end end |