1
# XSD4R - REXMLParser XML parser library.
2
# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
4
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
5
# redistribute it and/or modify it under the same terms of Ruby's license;
6
# either the dual license version in 2003, or any later version.
9
require 'xsd/xmlparser'
10
require 'rexml/streamlistener'
11
require 'rexml/document'
18
class REXMLParser < XSD::XMLParser::Parser
19
include REXML::StreamListener
21
def do_parse(string_or_readable)
23
source = REXML::SourceFactory.create_from(string_or_readable)
24
source.encoding = charset if charset
25
# Listener passes a String in utf-8.
27
REXML::Document.parse_stream(source, self)
33
def tag_start(name, attrs)
34
start_element(name, attrs)
45
def xmldecl(version, encoding, standalone)
46
# Version should be checked.