Class: RGen::Instantiator::NodebasedXMLInstantiator::Visitor
- Inherits:
-
Nokogiri::XML::SAX::Document
- Object
- Nokogiri::XML::SAX::Document
- RGen::Instantiator::NodebasedXMLInstantiator::Visitor
- Defined in:
- lib/rgen/instantiator/nodebased_xml_instantiator.rb
Instance Attribute Summary collapse
-
#namespaces ⇒ Object
readonly
Returns the value of attribute namespaces.
Instance Method Summary collapse
- #characters(str) ⇒ Object
- #end_element(name) ⇒ Object
-
#initialize(inst) ⇒ Visitor
constructor
A new instance of Visitor.
- #start_element_namespace(tag, attributes, prefix, uri, ns) ⇒ Object
Constructor Details
#initialize(inst) ⇒ Visitor
Returns a new instance of Visitor.
44 45 46 47 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 44 def initialize(inst) @instantiator = inst @namespaces = {} end |
Instance Attribute Details
#namespaces ⇒ Object (readonly)
Returns the value of attribute namespaces.
42 43 44 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 42 def namespaces @namespaces end |
Instance Method Details
#characters(str) ⇒ Object
61 62 63 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 61 def characters(str) @instantiator.on_chardata(str) end |
#end_element(name) ⇒ Object
57 58 59 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 57 def end_element(name) @instantiator.end_element end |
#start_element_namespace(tag, attributes, prefix, uri, ns) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 49 def start_element_namespace(tag, attributes, prefix, uri, ns) ns.each{|n| @namespaces[n[0]] = n[1]} attrs = {} attributes.each{|a| attrs[a.prefix ? a.prefix+":"+a.localname : a.localname] = a.value} qname = prefix ? prefix+":"+tag : tag @instantiator.start_element(uri, qname, prefix, tag, attrs) end |