Sha256: 96ad2085c348a3c14afd80b5999e3d493ccfd557bb150b293fdd0cd419c5b556

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

= MultiXML
==== A generic swappable back-end for XML parsing

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, <tt>multi_xml</tt> 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 <tt>parser</tt> setter takes either a symbol or a class (to allow for custom XML parsers) that responds to <tt>.parse</tt> 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[http://github.com/intridea/multi_json/].

== 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 (c) 2010 Erik Michaels-Ober. See LICENSE for details.

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
multi_xml-0.2.0 README.rdoc
multi_xml-0.1.4 README.rdoc
multi_xml-0.1.3 README.rdoc
multi_xml-0.1.2 README.rdoc
multi_xml-0.1.1 README.rdoc