multi_xml 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of multi_xml might be problematic. Click here for more details.
- data/.gemtest +0 -0
- data/.gitignore +6 -1
- data/.yardopts +5 -0
- data/{LICENSE → LICENSE.mkd} +0 -0
- data/README.mkd +84 -0
- data/Rakefile +12 -20
- data/lib/multi_xml.rb +7 -7
- data/lib/multi_xml/core_extensions.rb +7 -7
- data/lib/multi_xml/parsers/libxml.rb +1 -2
- data/lib/multi_xml/parsers/nokogiri.rb +1 -2
- data/lib/multi_xml/parsers/rexml.rb +1 -2
- data/lib/multi_xml/version.rb +1 -1
- data/multi_xml.gemspec +16 -13
- data/spec/multi_xml_spec.rb +57 -5
- data/spec/spec_helper.rb +7 -10
- metadata +57 -58
- data/Gemfile.lock +0 -35
- data/README.rdoc +0 -33
data/.gemtest
ADDED
File without changes
|
data/.gitignore
CHANGED
data/.yardopts
ADDED
data/{LICENSE → LICENSE.mkd}
RENAMED
File without changes
|
data/README.mkd
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
MultiXML
|
2
|
+
========
|
3
|
+
A generic swappable back-end for XML parsing
|
4
|
+
|
5
|
+
Installation
|
6
|
+
------------
|
7
|
+
$ [sudo] gem install multi_xml
|
8
|
+
|
9
|
+
Documentation
|
10
|
+
-------------
|
11
|
+
<http://rdoc.info/gems/multi_xml>
|
12
|
+
|
13
|
+
Usage Examples
|
14
|
+
--------------
|
15
|
+
Lots of Ruby libraries utilize XML parsing in some form, and everyone has their favorite XML library.
|
16
|
+
In order to best support multiple XML parsers and libraries, <tt>multi_xml</tt> is a general-purpose
|
17
|
+
swappable XML backend library. You use it like so:
|
18
|
+
|
19
|
+
require 'multi_xml'
|
20
|
+
|
21
|
+
MultiXml.parser = :libxml
|
22
|
+
MultiXml.parser = MultiXml::Parsers::Libxml # Same as above
|
23
|
+
MultiXml.parse('<tag>This is the contents</tag>') # Parsed using LibXML
|
24
|
+
|
25
|
+
MultiXml.parser = :nokogiri
|
26
|
+
MultiXml.parser = MultiXml::Parsers::Nokogiri # Same as above
|
27
|
+
MultiXml.parse('<tag>This is the contents</tag>') # Parsed using Nokogiri
|
28
|
+
|
29
|
+
MultiXml.parser = :rexml
|
30
|
+
MultiXml.parser = MultiXml::Parsers::Rexml # Same as above
|
31
|
+
MultiXml.parse('<tag>This is the contents</tag>') # Parsed using REXML
|
32
|
+
|
33
|
+
The <tt>parser</tt> setter takes either a symbol or a class (to allow for custom XML parsers) that
|
34
|
+
responds to <tt>.parse</tt> at the class level.
|
35
|
+
|
36
|
+
MultiXML tries to have intelligent defaulting. That is, if you have any of the supported parsers
|
37
|
+
already loaded, it will utilize them before attempting to load any. When loading, libraries are
|
38
|
+
ordered by speed: first LibXML, then Nokogiri, then REXML.
|
39
|
+
|
40
|
+
Contributing
|
41
|
+
------------
|
42
|
+
In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
|
43
|
+
|
44
|
+
Here are some ways *you* can contribute:
|
45
|
+
|
46
|
+
* by using alpha, beta, and prerelease versions
|
47
|
+
* by reporting bugs
|
48
|
+
* by suggesting new features
|
49
|
+
* by writing or editing documentation
|
50
|
+
* by writing specifications
|
51
|
+
* by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
|
52
|
+
* by refactoring code
|
53
|
+
* by resolving [issues](http://github.com/sferik/multi_xml/issues)
|
54
|
+
* by reviewing patches
|
55
|
+
|
56
|
+
Submitting an Issue
|
57
|
+
-------------------
|
58
|
+
We use the [GitHub issue tracker](http://github.com/sferik/multi_xml/issues) to track bugs and
|
59
|
+
features. Before submitting a bug report or feature request, check to make sure it hasn't already
|
60
|
+
been submitted. You can indicate support for an existing issuse by voting it up. When submitting a
|
61
|
+
bug report, please include a [Gist](http://gist.github.com/) that includes a stack trace and any
|
62
|
+
details that may be necessary to reproduce the bug, including your gem version, Ruby version, and
|
63
|
+
operating system. Ideally, a bug report should include a pull request with failing specs.
|
64
|
+
|
65
|
+
Submitting a Pull Request
|
66
|
+
-------------------------
|
67
|
+
1. Fork the project.
|
68
|
+
2. Create a topic branch.
|
69
|
+
3. Implement your feature or bug fix.
|
70
|
+
4. Add documentation for your feature or bug fix.
|
71
|
+
5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4.
|
72
|
+
6. Add specs for your feature or bug fix.
|
73
|
+
7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100% covered, go back to step 6.
|
74
|
+
8. Commit and push your changes.
|
75
|
+
9. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)
|
76
|
+
|
77
|
+
Inspiration
|
78
|
+
-----------
|
79
|
+
MultiXML was inspired by [MultiJSON](http://github.com/intridea/multi_json/).
|
80
|
+
|
81
|
+
Copyright
|
82
|
+
---------
|
83
|
+
Copyright (c) 2010 Erik Michaels-Ober.
|
84
|
+
See [LICENSE](https://github.com/sferik/multi_xml/blob/master/LICENSE.mkd) for details.
|
data/Rakefile
CHANGED
@@ -1,29 +1,21 @@
|
|
1
1
|
require 'bundler'
|
2
|
-
Bundler.setup
|
3
2
|
Bundler::GemHelper.install_tasks
|
4
3
|
|
5
4
|
require 'rspec/core/rake_task'
|
6
5
|
RSpec::Core::RakeTask.new(:spec)
|
7
6
|
|
8
|
-
|
9
|
-
desc "Run all examples using rcov"
|
10
|
-
RSpec::Core::RakeTask.new :rcov => :cleanup_rcov_files do |t|
|
11
|
-
t.rcov = true
|
12
|
-
t.rcov_opts = %[-Ilib -Ispec --exclude "gems/*,features"]
|
13
|
-
t.rcov_opts << %[--text-report --sort coverage]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
task :cleanup_rcov_files do
|
18
|
-
rm_rf 'coverage'
|
19
|
-
end
|
20
|
-
|
7
|
+
task :test => :spec
|
21
8
|
task :default => :spec
|
22
9
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
10
|
+
namespace :doc do
|
11
|
+
require 'yard'
|
12
|
+
YARD::Rake::YardocTask.new do |task|
|
13
|
+
task.files = ['LICENSE.mkd', 'lib/**/*.rb']
|
14
|
+
task.options = [
|
15
|
+
'--no-private',
|
16
|
+
'--protected',
|
17
|
+
'--output-dir', 'doc/yard',
|
18
|
+
'--markup', 'markdown',
|
19
|
+
]
|
20
|
+
end
|
29
21
|
end
|
data/lib/multi_xml.rb
CHANGED
@@ -75,13 +75,13 @@ module MultiXml
|
|
75
75
|
# * <tt>:rexml</tt>
|
76
76
|
def parser=(new_parser)
|
77
77
|
case new_parser
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
78
|
+
when String, Symbol
|
79
|
+
require "multi_xml/parsers/#{new_parser.to_s.downcase}"
|
80
|
+
@parser = MultiXml::Parsers.const_get("#{new_parser.to_s.split('_').map{|s| s.capitalize}.join('')}")
|
81
|
+
when Class, Module
|
82
|
+
@parser = new_parser
|
83
|
+
else
|
84
|
+
raise "Did not recognize your parser specification. Please specify either a symbol or a class."
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -4,7 +4,7 @@ class Object #:nodoc:
|
|
4
4
|
# @example [].blank? #=> true
|
5
5
|
# @example [1].blank? #=> false
|
6
6
|
# @example [nil].blank? #=> false
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# Returns true if the object is nil or empty (if applicable)
|
9
9
|
def blank?
|
10
10
|
nil? || (respond_to?(:empty?) && empty?)
|
@@ -13,7 +13,7 @@ end
|
|
13
13
|
|
14
14
|
class Numeric #:nodoc:
|
15
15
|
# @return <TrueClass, FalseClass>
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# Numerics can't be blank
|
18
18
|
def blank?
|
19
19
|
false
|
@@ -22,7 +22,7 @@ end
|
|
22
22
|
|
23
23
|
class NilClass #:nodoc:
|
24
24
|
# @return <TrueClass, FalseClass>
|
25
|
-
#
|
25
|
+
#
|
26
26
|
# Nils are always blank
|
27
27
|
def blank?
|
28
28
|
true
|
@@ -31,8 +31,8 @@ end
|
|
31
31
|
|
32
32
|
class TrueClass #:nodoc:
|
33
33
|
# @return <TrueClass, FalseClass>
|
34
|
-
#
|
35
|
-
# True is not blank.
|
34
|
+
#
|
35
|
+
# True is not blank.
|
36
36
|
def blank?
|
37
37
|
false
|
38
38
|
end
|
@@ -49,9 +49,9 @@ class String #:nodoc:
|
|
49
49
|
# @example "".blank? #=> true
|
50
50
|
# @example " ".blank? #=> true
|
51
51
|
# @example " hey ho ".blank? #=> false
|
52
|
-
#
|
52
|
+
#
|
53
53
|
# @return <TrueClass, FalseClass>
|
54
|
-
#
|
54
|
+
#
|
55
55
|
# Strips out whitespace then tests if the string is empty.
|
56
56
|
def blank?
|
57
57
|
strip.empty?
|
@@ -2,12 +2,11 @@ require 'libxml' unless defined?(LibXML)
|
|
2
2
|
|
3
3
|
module MultiXml
|
4
4
|
module Parsers
|
5
|
-
# Use LibXML to parse XML.
|
6
5
|
module Libxml #:nodoc:
|
7
6
|
extend self
|
8
7
|
def parse_error; ::LibXML::XML::Error; end
|
9
8
|
|
10
|
-
# Parse an XML Document string or IO into a simple hash using
|
9
|
+
# Parse an XML Document string or IO into a simple hash using LibXML.
|
11
10
|
# xml::
|
12
11
|
# XML Document string or IO to parse
|
13
12
|
def parse(xml)
|
@@ -2,12 +2,11 @@ require 'nokogiri' unless defined?(Nokogiri)
|
|
2
2
|
|
3
3
|
module MultiXml
|
4
4
|
module Parsers
|
5
|
-
# Use Nokogiri to parse XML.
|
6
5
|
module Nokogiri #:nodoc:
|
7
6
|
extend self
|
8
7
|
def parse_error; ::Nokogiri::XML::SyntaxError; end
|
9
8
|
|
10
|
-
# Parse an XML Document string or IO into a simple hash using
|
9
|
+
# Parse an XML Document string or IO into a simple hash using Nokogiri.
|
11
10
|
# xml::
|
12
11
|
# XML Document string or IO to parse
|
13
12
|
def parse(xml)
|
@@ -2,14 +2,13 @@ require 'rexml/document' unless defined?(REXML::Document)
|
|
2
2
|
|
3
3
|
module MultiXml
|
4
4
|
module Parsers
|
5
|
-
# Use REXML to parse XML.
|
6
5
|
module Rexml #:nodoc:
|
7
6
|
extend self
|
8
7
|
def parse_error; ::REXML::ParseException; end
|
9
8
|
|
10
9
|
CONTENT_ROOT = '__content__'.freeze unless defined?(CONTENT_ROOT)
|
11
10
|
|
12
|
-
# Parse an XML Document string or IO into a simple hash
|
11
|
+
# Parse an XML Document string or IO into a simple hash using REXML
|
13
12
|
#
|
14
13
|
# xml::
|
15
14
|
# XML Document string or IO to parse
|
data/lib/multi_xml/version.rb
CHANGED
data/multi_xml.gemspec
CHANGED
@@ -1,25 +1,28 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'multi_xml/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.add_development_dependency(
|
7
|
-
s.add_development_dependency(
|
8
|
-
s.add_development_dependency(
|
9
|
-
s.add_development_dependency(
|
10
|
-
s.add_development_dependency(
|
11
|
-
s.add_development_dependency(
|
12
|
-
s.
|
6
|
+
s.add_development_dependency('bundler', '~> 1.0')
|
7
|
+
s.add_development_dependency('libxml-ruby', '~> 1.1')
|
8
|
+
s.add_development_dependency('maruku', '~> 0.6')
|
9
|
+
s.add_development_dependency('nokogiri', '~> 1.4')
|
10
|
+
s.add_development_dependency('rake', '~> 0.8')
|
11
|
+
s.add_development_dependency('rspec', '~> 2.4')
|
12
|
+
s.add_development_dependency('simplecov', '~> 0.3')
|
13
|
+
s.add_development_dependency('yard', '~> 0.6')
|
14
|
+
s.add_development_dependency('ZenTest', '~> 4.4')
|
15
|
+
s.name = 'multi_xml'
|
13
16
|
s.version = MultiXml::VERSION
|
14
17
|
s.platform = Gem::Platform::RUBY
|
15
18
|
s.authors = ["Erik Michaels-Ober"]
|
16
|
-
s.email = [
|
17
|
-
s.homepage =
|
19
|
+
s.email = ['[email protected]']
|
20
|
+
s.homepage = 'http://rubygems.org/gems/multi_xml'
|
18
21
|
s.summary = %q{A generic swappable back-end for XML parsing}
|
19
22
|
s.description = %q{A gem to provide swappable XML backends utilizing LibXML, Nokogiri, or REXML.}
|
20
|
-
s.rubyforge_project =
|
23
|
+
s.rubyforge_project = 'multi_xml'
|
21
24
|
s.files = `git ls-files`.split("\n")
|
22
25
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
26
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
-
s.require_paths = [
|
27
|
+
s.require_paths = ['lib']
|
25
28
|
end
|
data/spec/multi_xml_spec.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
-
class MockDecoder
|
4
|
-
def self.parse(xml)
|
5
|
-
'<tag>This is the contents</tag>'
|
6
|
-
end
|
7
|
-
end
|
3
|
+
class MockDecoder; end
|
8
4
|
|
9
5
|
describe "MultiXml" do
|
10
6
|
context "Parsers" do
|
11
7
|
it "should default to the best available gem" do
|
8
|
+
pending
|
9
|
+
MultiXml.parser.name.should == 'MultiXml::Parsers::Rexml'
|
10
|
+
require 'nokogiri'
|
11
|
+
MultiXml.parser.name.should == 'MultiXml::Parsers::Nokogiri'
|
12
12
|
require 'libxml'
|
13
13
|
MultiXml.parser.name.should == 'MultiXml::Parsers::Libxml'
|
14
14
|
end
|
@@ -127,6 +127,58 @@ describe "MultiXml" do
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
+
context "when value is true" do
|
131
|
+
before do
|
132
|
+
pending
|
133
|
+
@xml = '<tag>true</tag>'
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should return true" do
|
137
|
+
MultiXml.parse(@xml)['tag'].should be_true
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
context "when value is false" do
|
142
|
+
before do
|
143
|
+
pending
|
144
|
+
@xml = '<tag>false</tag>'
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should return false" do
|
148
|
+
MultiXml.parse(@xml)['tag'].should be_false
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
context "when key is id" do
|
153
|
+
before do
|
154
|
+
pending
|
155
|
+
@xml = '<id>1</id>'
|
156
|
+
end
|
157
|
+
|
158
|
+
it "should return a Fixnum" do
|
159
|
+
MultiXml.parse(@xml)['id'].should be_a(Fixnum)
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should return the correct number" do
|
163
|
+
MultiXml.parse(@xml)['id'].should == 1
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
context "when key contains _id" do
|
168
|
+
before do
|
169
|
+
pending
|
170
|
+
@xml = '<tag_id>1</tag_id>'
|
171
|
+
end
|
172
|
+
|
173
|
+
it "should return a Fixnum" do
|
174
|
+
MultiXml.parse(@xml)['tag_id'].should be_a(Fixnum)
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should return the correct number" do
|
178
|
+
MultiXml.parse(@xml)['tag_id'].should == 1
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
130
182
|
context "with an attribute type=\"boolean\"" do
|
131
183
|
%w(true false).each do |boolean|
|
132
184
|
context "when #{boolean}" do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require 'rspec/core'
|
5
|
-
require 'rubygems'
|
6
|
-
begin
|
7
|
-
require 'bundler'
|
8
|
-
Bundler.setup
|
9
|
-
rescue LoadError
|
10
|
-
$stderr.puts "Bundler (or a dependency) not available."
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_group 'Libraries', 'lib'
|
11
4
|
end
|
5
|
+
|
6
|
+
require File.expand_path('../../lib/multi_xml', __FILE__)
|
7
|
+
|
8
|
+
require 'rspec'
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 0.2.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.2.1
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Erik Michaels-Ober
|
@@ -15,99 +10,108 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
13
|
+
date: 2011-02-03 00:00:00 -05:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
17
|
+
name: bundler
|
18
|
+
prerelease: false
|
22
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
20
|
none: false
|
24
21
|
requirements:
|
25
22
|
- - ~>
|
26
23
|
- !ruby/object:Gem::Version
|
27
|
-
hash: 15
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 0
|
31
24
|
version: "1.0"
|
32
25
|
type: :development
|
33
|
-
prerelease: false
|
34
|
-
name: bundler
|
35
26
|
version_requirements: *id001
|
36
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: libxml-ruby
|
29
|
+
prerelease: false
|
37
30
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
31
|
none: false
|
39
32
|
requirements:
|
40
33
|
- - ~>
|
41
34
|
- !ruby/object:Gem::Version
|
42
|
-
hash: 13
|
43
|
-
segments:
|
44
|
-
- 1
|
45
|
-
- 1
|
46
35
|
version: "1.1"
|
47
36
|
type: :development
|
48
|
-
prerelease: false
|
49
|
-
name: libxml-ruby
|
50
37
|
version_requirements: *id002
|
51
38
|
- !ruby/object:Gem::Dependency
|
39
|
+
name: maruku
|
40
|
+
prerelease: false
|
52
41
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
42
|
none: false
|
54
43
|
requirements:
|
55
44
|
- - ~>
|
56
45
|
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 1
|
60
|
-
- 4
|
61
|
-
version: "1.4"
|
46
|
+
version: "0.6"
|
62
47
|
type: :development
|
63
|
-
prerelease: false
|
64
|
-
name: nokogiri
|
65
48
|
version_requirements: *id003
|
66
49
|
- !ruby/object:Gem::Dependency
|
50
|
+
name: nokogiri
|
51
|
+
prerelease: false
|
67
52
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
53
|
none: false
|
69
54
|
requirements:
|
70
55
|
- - ~>
|
71
56
|
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
- 8
|
76
|
-
version: "0.8"
|
57
|
+
version: "1.4"
|
77
58
|
type: :development
|
78
|
-
prerelease: false
|
79
|
-
name: rake
|
80
59
|
version_requirements: *id004
|
81
60
|
- !ruby/object:Gem::Dependency
|
61
|
+
name: rake
|
62
|
+
prerelease: false
|
82
63
|
requirement: &id005 !ruby/object:Gem::Requirement
|
83
64
|
none: false
|
84
65
|
requirements:
|
85
66
|
- - ~>
|
86
67
|
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
- 9
|
91
|
-
version: "0.9"
|
68
|
+
version: "0.8"
|
92
69
|
type: :development
|
93
|
-
prerelease: false
|
94
|
-
name: rcov
|
95
70
|
version_requirements: *id005
|
96
71
|
- !ruby/object:Gem::Dependency
|
72
|
+
name: rspec
|
73
|
+
prerelease: false
|
97
74
|
requirement: &id006 !ruby/object:Gem::Requirement
|
98
75
|
none: false
|
99
76
|
requirements:
|
100
77
|
- - ~>
|
101
78
|
- !ruby/object:Gem::Version
|
102
|
-
|
103
|
-
segments:
|
104
|
-
- 2
|
105
|
-
- 0
|
106
|
-
version: "2.0"
|
79
|
+
version: "2.4"
|
107
80
|
type: :development
|
108
|
-
prerelease: false
|
109
|
-
name: rspec
|
110
81
|
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: simplecov
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: "0.3"
|
91
|
+
type: :development
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: yard
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: "0.6"
|
102
|
+
type: :development
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: ZenTest
|
106
|
+
prerelease: false
|
107
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ~>
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: "4.4"
|
113
|
+
type: :development
|
114
|
+
version_requirements: *id009
|
111
115
|
description: A gem to provide swappable XML backends utilizing LibXML, Nokogiri, or REXML.
|
112
116
|
email:
|
113
117
|
|
@@ -118,12 +122,13 @@ extensions: []
|
|
118
122
|
extra_rdoc_files: []
|
119
123
|
|
120
124
|
files:
|
125
|
+
- .gemtest
|
121
126
|
- .gitignore
|
122
127
|
- .rspec
|
128
|
+
- .yardopts
|
123
129
|
- Gemfile
|
124
|
-
-
|
125
|
-
-
|
126
|
-
- README.rdoc
|
130
|
+
- LICENSE.mkd
|
131
|
+
- README.mkd
|
127
132
|
- Rakefile
|
128
133
|
- lib/multi_xml.rb
|
129
134
|
- lib/multi_xml/core_extensions.rb
|
@@ -148,23 +153,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
153
|
requirements:
|
149
154
|
- - ">="
|
150
155
|
- !ruby/object:Gem::Version
|
151
|
-
hash: 3
|
152
|
-
segments:
|
153
|
-
- 0
|
154
156
|
version: "0"
|
155
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
158
|
none: false
|
157
159
|
requirements:
|
158
160
|
- - ">="
|
159
161
|
- !ruby/object:Gem::Version
|
160
|
-
hash: 3
|
161
|
-
segments:
|
162
|
-
- 0
|
163
162
|
version: "0"
|
164
163
|
requirements: []
|
165
164
|
|
166
165
|
rubyforge_project: multi_xml
|
167
|
-
rubygems_version: 1.
|
166
|
+
rubygems_version: 1.5.0
|
168
167
|
signing_key:
|
169
168
|
specification_version: 3
|
170
169
|
summary: A generic swappable back-end for XML parsing
|
data/Gemfile.lock
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
multi_xml (0.2.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: http://rubygems.org/
|
8
|
-
specs:
|
9
|
-
diff-lcs (1.1.2)
|
10
|
-
libxml-ruby (1.1.4)
|
11
|
-
nokogiri (1.4.3.1)
|
12
|
-
rake (0.8.7)
|
13
|
-
rcov (0.9.9)
|
14
|
-
rspec (2.0.1)
|
15
|
-
rspec-core (~> 2.0.1)
|
16
|
-
rspec-expectations (~> 2.0.1)
|
17
|
-
rspec-mocks (~> 2.0.1)
|
18
|
-
rspec-core (2.0.1)
|
19
|
-
rspec-expectations (2.0.1)
|
20
|
-
diff-lcs (>= 1.1.2)
|
21
|
-
rspec-mocks (2.0.1)
|
22
|
-
rspec-core (~> 2.0.1)
|
23
|
-
rspec-expectations (~> 2.0.1)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
bundler (~> 1.0)
|
30
|
-
libxml-ruby (~> 1.1)
|
31
|
-
multi_xml!
|
32
|
-
nokogiri (~> 1.4)
|
33
|
-
rake (~> 0.8)
|
34
|
-
rcov (~> 0.9)
|
35
|
-
rspec (~> 2.0)
|
data/README.rdoc
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
= MultiXML
|
2
|
-
==== A generic swappable back-end for XML parsing
|
3
|
-
|
4
|
-
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:
|
5
|
-
|
6
|
-
require 'multi_xml'
|
7
|
-
|
8
|
-
MultiXml.parser = :nokogiri
|
9
|
-
MultiXml.parse('<tag>This is the contents</tag>') # parsed using Nokogiri
|
10
|
-
|
11
|
-
MultiXml.parser = :rexml
|
12
|
-
MultiXml.parser = MultiJson::Parser::Rexml # equivalent to previous line
|
13
|
-
MultiXml.parse('<tag>This is the contents</tag>') # parsed using REXML
|
14
|
-
|
15
|
-
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.
|
16
|
-
|
17
|
-
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.
|
18
|
-
|
19
|
-
== Inspiration
|
20
|
-
|
21
|
-
MultiXML was inspired by MultiJSON[http://github.com/intridea/multi_json/].
|
22
|
-
|
23
|
-
== Submitting Patches
|
24
|
-
|
25
|
-
1. Fork the project.
|
26
|
-
2. Commit your feature or bug fix.
|
27
|
-
3. Add tests for it. This is important so it doesn't break in the future.
|
28
|
-
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.)
|
29
|
-
5. Submit a pull request. Bonus points for topic branches.
|
30
|
-
|
31
|
-
== Copyright
|
32
|
-
|
33
|
-
Copyright (c) 2010 Erik Michaels-Ober. See LICENSE for details.
|