class XSD::XMLParser::OxDocHandler

Public Class Methods

new(owner, decoder) click to toggle source
# File lib/xsd/xmlparser/oxparser.rb, line 45
def initialize(owner, decoder)
  @owner = owner
  @decoder = decoder
  reset_for_next_element
end

Public Instance Methods

attr(key, val) click to toggle source
# File lib/xsd/xmlparser/oxparser.rb, line 51
def attr(key, val)
  @attr_hash[key.to_s]=val
end
attrs_done() click to toggle source
# 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
cdata(t)
Alias for: text
end_element(name) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/xsd/xmlparser/oxparser.rb, line 62
def start_element(name)
  @element_name = name.to_s
end
text(t) click to toggle source
# File lib/xsd/xmlparser/oxparser.rb, line 71
def text(t)
  @decoder.nil? ? @owner.characters(t) : @owner.characters(@decoder.decode(t))
end
Also aliased as: cdata

Private Instance Methods

reset_for_next_element() click to toggle source
# File lib/xsd/xmlparser/oxparser.rb, line 90
def reset_for_next_element
  @attr_hash = {}
  @element_name = ""
end