Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A generic swappable back-end for XML parsing
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.rspec
Gemfile
Gemfile.lock
LICENSE
README.rdoc
Rakefile
multi_xml.gemspec

README.rdoc

MultiXML

Lots of Ruby libraries utilize XML parsing in some form, and everyone has their favorite XML library. In order to best support multiple XML parsers and libraries, multi_xml is a general-purpose swappable XML backend library. You use it like so:

require 'multi_xml'

MultiXml.parser = :nokogiri
MultiXml.parse('<tag>This is the contents</tag>') # parsed using Nokogiri

MultiXml.parser = :rexml
MultiXml.parser = MultiJson::Parser::Rexml # equivalent to previous line
MultiXml.parse('<tag>This is the contents</tag>') # parsed using REXML

The parser setter takes either a symbol or a class (to allow for custom XML parsers) that responds to .parse at the class level.

MultiXML tries to have intelligent defaulting. That is, if you have any of the supported parsers already loaded, it will utilize them before attempting to load any. When loading, libraries are ordered by speed. First LibXML, then Nokogiri, then REXML.

Inspiration

MultiXML was inspired by MultiJSON.

Submitting Patches

  1. Fork the project.

  2. Commit your feature or bug fix.

  3. Add tests for it. This is important so it doesn't break in the future.

  4. Do not mess with gemspec, version, or history. (If you want to have your own version, that's fine, but please do so in a separate commit.)

  5. Submit a pull request. Bonus points for topic branches.

Copyright

Copyright © 2010 Erik Michaels-Ober. See LICENSE for details.

Something went wrong with that request. Please try again.