Class: Moxml::C14n::AttributeHandler

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

Overview

Attribute axis handler for inclusive C14N. Implements W3C C14N 1.0 §2.4 / 1.1 §2.4 attribute rendering, including resolution of simple inheritable attributes (xml:lang, xml:space) for document subsets.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(encoder) ⇒ AttributeHandler

Returns a new instance of AttributeHandler.



12
13
14
# File 'lib/moxml/c14n/attribute_handler.rb', line 12

def initialize(encoder)
  @encoder = encoder
end

Instance Attribute Details

#encoderObject (readonly)

Returns the value of attribute encoder.



10
11
12
# File 'lib/moxml/c14n/attribute_handler.rb', line 10

def encoder
  @encoder
end

Instance Method Details

#process_attributes(element, output, omitted_ancestors = []) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/moxml/c14n/attribute_handler.rb', line 16

def process_attributes(element, output, omitted_ancestors = [])
  return unless element.in_node_set?

  attributes = collect_attributes(element, omitted_ancestors)
  attributes.each do |attr|
    output << " "
    output << attr.qname
    output << '="'
    output << encoder.encode_attribute(attr.value)
    output << '"'
  end
end