Class: VCDOM::XMLLS::XMLParser

Inherits:
Object
  • Object
show all
Defined in:
lib/vcdom/xml_ls/xml_parser.rb

Instance Method Summary collapse

Instance Method Details

#parse(input) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/vcdom/xml_ls/xml_parser.rb', line 67

def parse( input )
  source = input.string_data
  if source.class == String then
    # Ruby 1.8 の場合, String を 1 文字ずつに分ける
    if RUBY_VERSION < "1.9"
      source = source.split //u
      class << source
        def []( *args )
          res = super( *args )
          args.length == 2 ? res.join : res
        end
      end
    end
    _parse_xml_str( source, XMLContentHandler.new( VCDOM::Document ) )
  else
    raise ArgumentTypeError.new()
  end
end