Class: XSD::XMLParser::REXMLParser

Inherits:
Parser 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

#cdata(content) ⇒ Object



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

def cdata(content)
  characters(content)
end

#do_parse(string_or_readable) ⇒ Object



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

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



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

def epilogue
end

#tag_end(name) ⇒ Object



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

def tag_end(name)
  end_element(name)
end

#tag_start(name, attrs) ⇒ Object



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

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

#text(text) ⇒ Object



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

def text(text)
  characters(text)
end

#xmldecl(version, encoding, standalone) ⇒ Object



50
51
52
# File 'lib/xsd/xmlparser/rexmlparser.rb', line 50

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