Class: RGen::Instantiator::NodebasedXMLInstantiator::XMLScanVisitor
- Inherits:
-
Object
- Object
- RGen::Instantiator::NodebasedXMLInstantiator::XMLScanVisitor
- Includes:
- XMLScan::NSVisitor
- 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
-
#initialize(inst) ⇒ XMLScanVisitor
constructor
A new instance of XMLScanVisitor.
- #on_attr_value(str) ⇒ Object
- #on_attribute_ns(qname, prefix, localpart) ⇒ Object
- #on_chardata(str) ⇒ Object
- #on_etag(name) ⇒ Object
- #on_stag_end_empty_ns(qname, namespaces) ⇒ Object
- #on_stag_end_ns(qname, namespaces) ⇒ Object
Constructor Details
#initialize(inst) ⇒ XMLScanVisitor
Returns a new instance of XMLScanVisitor.
48 49 50 51 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 48 def initialize(inst) @current_attributes = {} @instantiator = inst end |
Instance Attribute Details
#namespaces ⇒ Object (readonly)
Returns the value of attribute namespaces.
44 45 46 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 44 def namespaces @namespaces end |
Instance Method Details
#on_attr_value(str) ⇒ Object
57 58 59 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 57 def on_attr_value(str) @current_attributes[@current_attr_name] = str end |
#on_attribute_ns(qname, prefix, localpart) ⇒ Object
53 54 55 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 53 def on_attribute_ns(qname, prefix, localpart) @current_attr_name = qname end |
#on_chardata(str) ⇒ Object
81 82 83 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 81 def on_chardata(str) @instantiator.on_chardata(str) end |
#on_etag(name) ⇒ Object
77 78 79 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 77 def on_etag(name) @instantiator.end_element end |
#on_stag_end_empty_ns(qname, namespaces) ⇒ Object
72 73 74 75 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 72 def on_stag_end_empty_ns(qname, namespaces) on_stag_end_ns(qname, namespaces) @instantiator.end_element end |
#on_stag_end_ns(qname, namespaces) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/rgen/instantiator/nodebased_xml_instantiator.rb', line 61 def on_stag_end_ns(qname, namespaces) @namespaces = namespaces if qname =~ /^([^:]+):([^:]+)$/ prefix, tag = $1, $2 else prefix, tag = nil, qname end @instantiator.start_element(namespaces[prefix], qname, prefix, tag, @current_attributes) @current_attributes = {} end |