Class OSM::StreamParser
In: lib/OSM/StreamParser.rb
Parent: Object

Class to parse XML files. This is a factory class. When calling OSM::StreamParser.new() an object of one of the following classes is created and returned: OSM::StreamParser::REXML, OSM::StreamParser::Libxml, OSM::StreamParser::Expat.

Usage:

  ENV['OSMLIB_XML_PARSER'] = 'Libxml'
  require 'OSM/StreamParser'
  parser = OSM::Streamparser.new(:filename => 'file.osm')
  result = parser.parse

Methods

new  

Classes and Modules

Class OSM::StreamParser::Expat
Class OSM::StreamParser::Libxml
Class OSM::StreamParser::REXML

Public Class methods

Create new StreamParser object. Only argument is a hash.

The hash keys:

  :filename  => name of XML file
  :string    => XML string
  :db        => an OSM::Database object
  :callbacks => an OSM::Callbacks object (or more likely from a derived class)
                if none was given a new OSM:Callbacks object is created

You can only use :filename or :string, not both.

[Source]

     # File lib/OSM/StreamParser.rb, line 264
264:         def self.new(options)
265:             eval "OSM::StreamParser::#{OSM.XMLParser}.new(options)"
266:         end

[Validate]