Class: Moxml::C14n::Processor

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

Overview

C14N 1.0/1.1 processor. Walks the data model and emits canonical octets. Handles node-set subsets (omitted ancestors), xml:base fixup, and xml:* inheritable attribute resolution.

Ported from canon (lutaml/canon).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(with_comments: false) ⇒ Processor

Returns a new instance of Processor.



13
14
15
16
17
18
19
# File 'lib/moxml/c14n/processor.rb', line 13

def initialize(with_comments: false)
  @with_comments = with_comments
  @encoder = CharacterEncoder.new
  @namespace_handler = NamespaceHandler.new(@encoder)
  @attribute_handler = AttributeHandler.new(@encoder)
  @xml_base_handler = XmlBaseHandler.new
end

Instance Attribute Details

#with_commentsObject (readonly)

Returns the value of attribute with_comments.



11
12
13
# File 'lib/moxml/c14n/processor.rb', line 11

def with_comments
  @with_comments
end

Instance Method Details

#process(root_node) ⇒ Object



21
22
23
24
25
# File 'lib/moxml/c14n/processor.rb', line 21

def process(root_node)
  output = (+"")
  process_node(root_node, output)
  output
end