Class: Moxml::C14n::Exclusive

Inherits:
Object
  • Object
show all
Defined in:
lib/moxml/c14n/exclusive.rb

Overview

Exclusive XML Canonicalization 1.0 (https://www.w3.org/TR/xml-exc-c14n/)

Renders only the namespaces visibly utilized by each element's qualified name and attributes (plus any in the inclusive prefix list), as opposed to inclusive C14N which renders every in-scope namespace on every element.

Output is UTF-8 octets with no BOM.

Instance Method Summary collapse

Instance Method Details

#canonicalize(node, with_comments: false, inclusive_namespaces: []) ⇒ Object

node: a Moxml::Node — element, document, text, comment, or PI. with_comments:: include comment nodes in output. inclusive_namespaces: list of prefixes to always include even if not visibly utilized (InclusiveNamespacesPrefixList parameter).



18
19
20
21
22
23
# File 'lib/moxml/c14n/exclusive.rb', line 18

def canonicalize(node, with_comments: false, inclusive_namespaces: [])
  writer = Writer.new
  context = NamespaceContext.new
  render(node, writer, context, with_comments, inclusive_namespaces)
  writer.output
end