class XSD::XMLParser::LibXMLParser
Constants
- ENTITY_REF_MAP
Public Instance Methods
do_parse(string_or_readable)
click to toggle source
# File lib/xsd/xmlparser/libxmlparser.rb, line 20 def do_parse(string_or_readable) if string_or_readable.respond_to?(:read) string = string_or_readable.read else string = string_or_readable end # XMLParser passes a String in utf-8. @charset = 'utf-8' @parser = XML::SaxParser.string(string) @parser.callbacks = self @parser.parse end
on_cdata_block(cdata)
click to toggle source
# File lib/xsd/xmlparser/libxmlparser.rb, line 106 def on_cdata_block(cdata) characters(cdata) end
on_characters(chars)
click to toggle source
# File lib/xsd/xmlparser/libxmlparser.rb, line 82 def on_characters(chars) characters(chars) end
on_end_element(name)
click to toggle source
# File lib/xsd/xmlparser/libxmlparser.rb, line 74 def on_end_element(name) end_element(name) end
on_external_subset(name, external_id, system_id)
click to toggle source
# File lib/xsd/xmlparser/libxmlparser.rb, line 110 def on_external_subset(name, external_id, system_id) nil end
on_parser_error(msg)
click to toggle source
# File lib/xsd/xmlparser/libxmlparser.rb, line 98 def on_parser_error(msg) raise ParseError.new(msg) end
on_parser_fatal_error(msg)
click to toggle source
# File lib/xsd/xmlparser/libxmlparser.rb, line 102 def on_parser_fatal_error(msg) raise ParseError.new(msg) end
on_parser_warning(msg)
click to toggle source
def on_comment(msg)
nil
end
# File lib/xsd/xmlparser/libxmlparser.rb, line 94 def on_parser_warning(msg) warn(msg) end
on_reference(name)
click to toggle source
# File lib/xsd/xmlparser/libxmlparser.rb, line 78 def on_reference(name) characters(ENTITY_REF_MAP[name]) end
on_start_element_ns(name, attributes, prefix, uri, namespaces)
click to toggle source
def on_end_document()
nil
end
# File lib/xsd/xmlparser/libxmlparser.rb, line 65 def on_start_element_ns(name, attributes, prefix, uri, namespaces) name = "#{prefix}:#{name}" unless prefix.nil? namespaces.each do |key,value| nsprefix = key.nil? ? "xmlns" : "xmlns:#{key}" attributes[nsprefix] = value end start_element(name, attributes) end