• Stars
    star
    157
  • Rank 237,323 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 14 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A generic swappable back-end for XML parsing

MultiXML

Gem Version Build Status Dependency Status Code Climate Coverage Status

A generic swappable back-end for XML parsing

Installation

gem install multi_xml

Documentation

http://rdoc.info/gems/multi_xml

Usage Examples

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 = :ox
MultiXml.parser = MultiXml::Parsers::Ox # Same as above
MultiXml.parse('<tag>This is the contents</tag>') # Parsed using Ox

MultiXml.parser = :libxml
MultiXml.parser = MultiXml::Parsers::Libxml # Same as above
MultiXml.parse('<tag>This is the contents</tag>') # Parsed using LibXML

MultiXml.parser = :nokogiri
MultiXml.parser = MultiXml::Parsers::Nokogiri # Same as above
MultiXml.parse('<tag>This is the contents</tag>') # Parsed using Nokogiri

MultiXml.parser = :rexml
MultiXml.parser = MultiXml::Parsers::Rexml # Same as above
MultiXml.parse('<tag>This is the contents</tag>') # Parsed using REXML

MultiXml.parser = :oga
MultiXml.parser = MultiXml::Parsers::Oga # Same as above
MultiXml.parse('<tag>This is the contents</tag>') # Parsed using Oga

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 Ox, then LibXML, then Nokogiri, and finally REXML.

Supported Ruby Versions

This library aims to support and is tested against the following Ruby implementations:

  • Ruby 2.2.2
  • Ruby 2.3.3
  • JRuby 9.1.6.0

If something doesn't work on one of these versions, it's a bug.

This library may inadvertently work (or seem to work) on other Ruby implementations, however support will only be provided for the versions listed above.

If you would like this library to support another Ruby version, you may volunteer to be a maintainer. Being a maintainer entails making sure all tests run and pass on that implementation. When something breaks on your implementation, you will be responsible for providing patches in a timely fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped.

Inspiration

MultiXML was inspired by MultiJSON.

Copyright

Copyright (c) 2010-2017 Erik Michaels-Ober. See LICENSE for details.

More Repositories

1

t-ruby

A command-line power tool for Twitter.
Ruby
5,425
star
2

twitter-ruby

A Ruby interface to the Twitter API.
Ruby
4,585
star
3

active_emoji

A collection of emoji aliases for core Ruby methods
Ruby
572
star
4

sign-in-with-twitter

A Ruby on Rails application that demonstrates how to use the Sign in with Twitter workflow using the twitter gem and OmniAuth.
Ruby
137
star
5

openai-ruby

Wrapper for calling OpenAI and GPT-3's HTTP APIs
Ruby
110
star
6

mtgox

Ruby wrapper for the Mt. Gox Trade API
Ruby
83
star
7

twitter-crystal

A library to access the Twitter API using Crystal
Crystal
82
star
8

dotfiles

Configuration files for all of my Unix utilities
Shell
80
star
9

merb-admin

MerbAdmin is a Merb plugin that provides an easy-to-use interface for managing your data
Ruby
70
star
10

mlb-ruby

A Ruby library for retrieving Major League Baseball teams, players, and transactions.
Ruby
65
star
11

x-ruby

A Ruby interface to the X API.
Ruby
61
star
12

openai-crystal

OpenAI API client library to access GPT-3 in Crystal
Crystal
44
star
13

spellout

A command-line tool that converts input into the International Radiotelephony Spelling Alphabet
Crystal
26
star
14

tradehill

Ruby wrapper for the TradeHill API
Ruby
14
star
15

pager

Git-style automatic paging in Ruby
Ruby
14
star
16

buftok

BufferedTokenizer extracts token delimited entities from a sequence of arbitrary inputs
Ruby
10
star
17

wc.cr

A POSIX-compliant implementation of the wc command-line utility, written in 50 lines of Crystal.
Shell
10
star
18

soundcloud-crystal

A library to access the SoundCloud API using Crystal
Crystal
10
star
19

x-crystal

A Crystal interface to the X API.
Crystal
9
star
20

gems

Ruby wrapper for the RubyGems.org API
Ruby
9
star
21

got

A Go port of the t Ruby gem
Go
4
star
22

geoip_server_test_data

Test data for https://github.com/JackDanger/geoip_server
4
star
23

410_in_140

A Twitter API v1 server in 140 characters
Ruby
4
star
24

hyperimage

Ruby
4
star
25

mwrc2012-app

Ruby
3
star
26

rspec-demo

Ruby
3
star
27

ruby

Get info about your Ruby environment
Ruby
3
star
28

timer

JavaScript countdown clock
3
star
29

ajax-demo

Ruby
3
star
30

nyt

iOS home screen icon for The New York Times newsstand app
3
star
31

backbone-todo

TODO app implemented in Backbone.js
JavaScript
2
star
32

movies

Ruby
2
star
33

rubysl-json

Ruby Standard Library - json
C
2
star
34

gitter

An API server that provides my personal GitHub and Twitter activity data in JSON format
Ruby
2
star
35

todo

Ruby
2
star
36

isitruby200

An app to check whether your code is Ruby 2.0.0 compatible.
CSS
2
star
37

carrierwave-demo

Rails app to demonstrate file uploads with CarrierWave
Ruby
2
star
38

sidekiq

Simple, efficient background processing for Ruby
Ruby
1
star
39

git-demo

This is a demo of how to use git
1
star
40

wdi

Ruby
1
star
41

library

Ruby
1
star
42

nynnets

Little exercises for Nynne
Ruby
1
star
43

rectangle

Ruby
1
star
44

sferik.github.com

Test deployment with GitHub
1
star
45

rubysl-etc

Ruby Standard Library - etc
Ruby
1
star
46

wsj

iOS home screen icon for The Wall Street Journal newsstand app
CSS
1
star
47

d3-demo

1
star
48

translations

Generation and translation of transcripts from talks on Confraks
Ruby
1
star