Class: XSD::XMLParser::REXMLParser

Inherits:
Parser
  • Object
show all
Includes:
REXML::StreamListener
Defined in:
lib/xsd/xmlparser/rexmlparser.rb

Instance Attribute Summary

Attributes inherited from Parser

#charset

Instance Method Summary collapse

Methods inherited from Parser

add_factory, create_parser, factory, #initialize, #parse

Constructor Details

This class inherits a constructor from XSD::XMLParser::Parser

Instance Method Details

#do_parse(string_or_readable) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/xsd/xmlparser/rexmlparser.rb', line 21

def do_parse(string_or_readable)
  source = nil
  source = REXML::SourceFactory.create_from(string_or_readable)
  source.encoding = charset if charset
  # Listener passes a String in utf-8.
  @charset = 'utf-8'
  REXML::Document.parse_stream(source, self)
end

#epilogueObject



30
31
# File 'lib/xsd/xmlparser/rexmlparser.rb', line 30

def epilogue
end

#tag_end(name) ⇒ Object



37
38
39
# File 'lib/xsd/xmlparser/rexmlparser.rb', line 37

def tag_end(name)
  end_element(name)
end

#tag_start(name, attrs) ⇒ Object



33
34
35
# File 'lib/xsd/xmlparser/rexmlparser.rb', line 33

def tag_start(name, attrs)
  start_element(name, attrs)
end

#text(text) ⇒ Object



41
42
43
# File 'lib/xsd/xmlparser/rexmlparser.rb', line 41

def text(text)
  characters(text)
end

#xmldecl(version, encoding, standalone) ⇒ Object



45
46
47
# File 'lib/xsd/xmlparser/rexmlparser.rb', line 45

def xmldecl(version, encoding, standalone)
  # Version should be checked.
end