Class: XSD::XMLParser::XMLScanner

Class | XSD::XMLParser::XMLScanner
In: | xsd/xmlparser/xmlscanner.rb
Parent: | XSD::XMLParser::Parser

### Methods

do_parse on_attr_charref on_attr_charref_hex on_attr_entityref on_attr_value on_attribute on_chardata on_charref on_charref_hex on_entityref on_etag on_stag on_stag_end on_stag_end_empty on_xmldecl_encoding on_xmldecl_version parse_error scanner_kcode= valid_error warning wellformed_error

### Included Modules

XMLScan::Visitor

### Constants

ENTITY_REF_MAP | = | { 'lt' => '<', 'gt' => '>', 'amp' => '&', 'quot' => '"', 'apos' => '\''

### Public Instance methods

do_parse(string_or_readable)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 20
      def do_parse(string_or_readable)
        @attrs = {}
        @curattr = nil
        @scanner = XMLScan::XMLScanner.new(self)
        @scanner.kcode = XSD::Charset.charset_str(charset) if charset
        @scanner.parse(string_or_readable)
      end

on_attr_charref(code)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 123
      def on_attr_charref(code)
        @curattr << [code].pack('U')
      end

on_attr_charref_hex(code)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 127
      def on_attr_charref_hex(code)
        on_attr_charref(code)
      end

on_attr_entityref(ref)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 119
      def on_attr_entityref(ref)
        @curattr << ENTITY_REF_MAP[ref]
      end

on_attr_value(str)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 115
      def on_attr_value(str)
        @curattr << str
      end

on_attribute(name)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 111
      def on_attribute(name)
        @attrs[name] = @curattr = ''
      end

on_chardata(str)

def on_pi(target, pi); end

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 81
      def on_chardata(str)
        characters(str)
      end

on_charref(code)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 95
      def on_charref(code)
        characters([code].pack('U'))
      end

on_charref_hex(code)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 99
      def on_charref_hex(code)
        on_charref(code)
      end

on_entityref(ref)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 91
      def on_entityref(ref)
        characters(ENTITY_REF_MAP[ref])
      end

on_etag(name)

def on_cdata(str); end

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 87
      def on_etag(name)
        end_element(name)
      end

on_stag(name)

def on_end_document; end

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 107
      def on_stag(name)
        @attrs = {}
      end

on_stag_end(name)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 138
      def on_stag_end(name)
        start_element(name, @attrs)
      end

on_stag_end_empty(name)

def on_attribute_end(name); end

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 133
      def on_stag_end_empty(name)
        on_stag_end(name)
        on_etag(name)
      end

on_xmldecl_encoding(str)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 63
      def on_xmldecl_encoding(str)
        self.scanner_kcode = str
      end

on_xmldecl_version(str)

def on_xmldecl; end

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 59
      def on_xmldecl_version(str)
        # 1.0 expected.
      end

parse_error(msg)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 41
      def parse_error(msg)
        raise ParseError.new(msg)
      end

scanner_kcode=(charset)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 28
      def scanner_kcode=(charset)
        @scanner.kcode = XSD::Charset.charset_str(charset) if charset
        self.xmldecl_encoding = charset
      end

valid_error(msg)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 49
      def valid_error(msg)
        raise NotValidError.new(msg)
      end

warning(msg)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 53
      def warning(msg)
        p msg if $DEBUG
      end

wellformed_error(msg)

[Source]

    # File xsd/xmlparser/xmlscanner.rb, line 45
      def wellformed_error(msg)
        raise NotWellFormedError.new(msg)
      end

[Validate]