Class: Nokogiri::XML::Node
- Defined in:
- vendor/bundler/ruby/3.1.0/bundler/gems/rdf-xsd-78bac0560463/lib/rdf/xsd/extensions.rb,
vendor/bundler/ruby/3.1.0/bundler/gems/rdf-rdfxml-8d0edd3cded9/lib/rdf/rdfxml/patches/nokogiri_hacks.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
-
#attribute_with_ns(name, namespace) ⇒ Nokogiri::XML::Attr
Monkey patch attribute_with_ns, to insure nil is returned for #null?.
- #attribute_with_ns_without_ffi_null ⇒ Object
-
#c14nxl(options = {}) ⇒ Object
Canonicalize the Node.
-
#to_s_with_c14nxl ⇒ Object
(also: #to_s)
Serialize a canonicalized Node or NodeSet to XML.
-
#uri ⇒ Object
URI of namespace + node_name.
Instance Method Details
#attribute_with_ns(name, namespace) ⇒ Nokogiri::XML::Attr
Monkey patch attribute_with_ns, to insure nil is returned for #null?
Get the attribute node with name and namespace
18 19 20 21 22 |
# File 'vendor/bundler/ruby/3.1.0/bundler/gems/rdf-rdfxml-8d0edd3cded9/lib/rdf/rdfxml/patches/nokogiri_hacks.rb', line 18 def attribute_with_ns(name, namespace) a = attribute_with_ns_without_ffi_null(name, namespace) (a.respond_to?(:null?) && a.null?) ? nil : a # to ensure FFI Pointer compatibility end |
#attribute_with_ns_without_ffi_null ⇒ Object
9 |
# File 'vendor/bundler/ruby/3.1.0/bundler/gems/rdf-rdfxml-8d0edd3cded9/lib/rdf/rdfxml/patches/nokogiri_hacks.rb', line 9 alias_method :attribute_with_ns_without_ffi_null, :attribute_with_ns |
#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 'vendor/bundler/ruby/3.1.0/bundler/gems/rdf-xsd-78bac0560463/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 'vendor/bundler/ruby/3.1.0/bundler/gems/rdf-xsd-78bac0560463/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 |