Class: XSD::XMLParser::OxDocHandler
- Defined in:
- lib/xsd/xmlparser/oxparser.rb
Instance Method Summary collapse
- #attr(key, val) ⇒ Object
- #attrs_done ⇒ Object
- #end_element(name) ⇒ Object
- #end_instruct(n) ⇒ Object
-
#initialize(owner, decoder) ⇒ OxDocHandler
constructor
A new instance of OxDocHandler.
- #instruct(n) ⇒ Object
- #start_element(name) ⇒ Object
- #text(t) ⇒ Object (also: #cdata)
Constructor Details
#initialize(owner, decoder) ⇒ OxDocHandler
Returns a new instance of OxDocHandler.
45 46 47 48 49 |
# File 'lib/xsd/xmlparser/oxparser.rb', line 45 def initialize(owner, decoder) @owner = owner @decoder = decoder reset_for_next_element end |
Instance Method Details
#attr(key, val) ⇒ Object
51 52 53 |
# File 'lib/xsd/xmlparser/oxparser.rb', line 51 def attr(key, val) @attr_hash[key.to_s]=val end |
#attrs_done ⇒ Object
55 56 57 58 59 60 |
# File 'lib/xsd/xmlparser/oxparser.rb', line 55 def attrs_done unless @element_name.nil? @owner.start_element(@element_name, @attr_hash) reset_for_next_element end end |
#end_element(name) ⇒ Object
66 67 68 69 |
# File 'lib/xsd/xmlparser/oxparser.rb', line 66 def end_element(name) name = name.to_s @owner.end_element(name) unless @element_name.nil? end |
#end_instruct(n) ⇒ Object
83 84 85 86 |
# File 'lib/xsd/xmlparser/oxparser.rb', line 83 def end_instruct(n) @owner.xmldecl_encoding= @attr_hash['encoding'] reset_for_next_element end |
#instruct(n) ⇒ Object
78 79 80 81 |
# File 'lib/xsd/xmlparser/oxparser.rb', line 78 def instruct(n) # Set @element_name to nil so DocHandler does nothing with attrs or element name. This is the outer "XML" tag. @element_name = nil end |
#start_element(name) ⇒ Object
62 63 64 |
# File 'lib/xsd/xmlparser/oxparser.rb', line 62 def start_element(name) @element_name = name.to_s end |
#text(t) ⇒ Object Also known as: cdata
71 72 73 |
# File 'lib/xsd/xmlparser/oxparser.rb', line 71 def text(t) @decoder.nil? ? @owner.characters(t) : @owner.characters(@decoder.decode(t)) end |