xml-object 0.9.9 → 0.9.91
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +1 -1
- data/README.rdoc +2 -9
- data/TODO +0 -1
- data/WHATSNEW +6 -0
- data/lib/xml-object/collection_proxy.rb +1 -0
- data/xml-object.gemspec +4 -3
- metadata +4 -3
- data/lib/xml-object/adapters/hpricot.rb +0 -40
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2008 Jordi Bunster <jordi@bunster.org>
|
1
|
+
Copyright (c) 2008, 2009 Jordi Bunster <jordi@bunster.org>
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.rdoc
CHANGED
@@ -77,13 +77,11 @@ this kind of job, but one doesn't always have that luxury.
|
|
77
77
|
=== Adapters
|
78
78
|
|
79
79
|
XMLObject supports different adapters to do the actual XML parsing. It ships
|
80
|
-
with +REXML+,
|
81
|
-
adapter is used.
|
80
|
+
with +REXML+, and +LibXML+ adapters. By default, the +REXML+ adapter is used.
|
82
81
|
|
83
82
|
To use a different adapter than the +REXML+ default:
|
84
83
|
|
85
84
|
require 'xml-object' # Require XMLObject first
|
86
|
-
require 'xml-object/adapters/hpricot'
|
87
85
|
require 'xml-object/adapters/libxml'
|
88
86
|
|
89
87
|
=== Access to elements and attributes
|
@@ -175,15 +173,10 @@ don't make the basic usage more complex. As usual, patches welcome.
|
|
175
173
|
|
176
174
|
=== Adapter specific
|
177
175
|
|
178
|
-
==== Hpricot adapter
|
179
|
-
|
180
|
-
While XMLObject doesn't yet aim to support namespaces, they seem to, for the
|
181
|
-
most part, work. That is, unless you're using the Hpricot adapter.
|
182
|
-
|
183
176
|
==== LibXML adapter
|
184
177
|
|
185
178
|
The LibXML adapter will not return the 'xmlns' attribute.
|
186
179
|
|
187
180
|
== Legal
|
188
181
|
|
189
|
-
Copyright (c) 2008 Jordi Bunster, released under the MIT license
|
182
|
+
Copyright (c) 2008, 2009 Jordi Bunster, released under the MIT license
|
data/TODO
CHANGED
@@ -3,6 +3,5 @@
|
|
3
3
|
* Decide if NameError is indeed better than nil?
|
4
4
|
* Decide if Element text should be stripped
|
5
5
|
* See if namespaces are a possibility.
|
6
|
-
* See if we can sort out Hpricot not folding namespaces.
|
7
6
|
* Figure out a way to fix the 'xmlns' problem in LibXML, remove entry from
|
8
7
|
caveats in README.rdoc
|
data/WHATSNEW
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
* 0.9.91 (????-??-??):
|
2
|
+
- Fixes a bug where consecutive collection proxies confused XMLObject
|
3
|
+
mid-parsing (Thanks to Josef Spillner)
|
4
|
+
- Dropped the Hpricot support. Not worth it, API changes too often, and
|
5
|
+
libxml-ruby now rocks more than ever.
|
6
|
+
|
1
7
|
* 0.9.9 (2008-12-18):
|
2
8
|
- Bugfix for the new faster-than-nokogiri Hpricot version (broke the API)
|
3
9
|
|
data/xml-object.gemspec
CHANGED
@@ -2,7 +2,7 @@ XMLOBJECT_GEMSPEC = Gem::Specification.new do |gem|
|
|
2
2
|
gem.name = gem.rubyforge_project = 'xml-object'
|
3
3
|
gem.homepage = 'http://xml-object.rubyforge.org'
|
4
4
|
|
5
|
-
gem.version, gem.date = '0.9.
|
5
|
+
gem.version, gem.date = '0.9.91', '2009-06-23'
|
6
6
|
gem.author, gem.email = 'Jordi Bunster', 'jordi@bunster.org'
|
7
7
|
|
8
8
|
gem.summary = "The Rubyista's way to do quick XML sit-ups"
|
@@ -11,7 +11,9 @@ XMLOBJECT_GEMSPEC = Gem::Specification.new do |gem|
|
|
11
11
|
documents of a known structure. While not devoid of caveats, it does
|
12
12
|
have a very pleasant, idiomatic Ruby syntax. }.strip!.gsub! /\s+/, ' '
|
13
13
|
|
14
|
-
gem.has_rdoc = !!(gem.extra_rdoc_files = %w[
|
14
|
+
gem.has_rdoc = !!(gem.extra_rdoc_files = %w[
|
15
|
+
README.rdoc MIT-LICENSE WHATSNEW ])
|
16
|
+
|
15
17
|
gem.rdoc_options += %w[
|
16
18
|
--title XMLObject --main README.rdoc --inline-source ]
|
17
19
|
|
@@ -24,7 +26,6 @@ XMLOBJECT_GEMSPEC = Gem::Specification.new do |gem|
|
|
24
26
|
lib/jordi-xml-object.rb
|
25
27
|
lib/xml-object
|
26
28
|
lib/xml-object/adapters
|
27
|
-
lib/xml-object/adapters/hpricot.rb
|
28
29
|
lib/xml-object/adapters/libxml.rb
|
29
30
|
lib/xml-object/adapters/rexml.rb
|
30
31
|
lib/xml-object/adapters.rb
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml-object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.91
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordi Bunster
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-06-23 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -21,6 +21,8 @@ extensions: []
|
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README.rdoc
|
24
|
+
- MIT-LICENSE
|
25
|
+
- WHATSNEW
|
24
26
|
files:
|
25
27
|
- MIT-LICENSE
|
26
28
|
- README.rdoc
|
@@ -30,7 +32,6 @@ files:
|
|
30
32
|
- lib/jordi-xml-object.rb
|
31
33
|
- lib/xml-object
|
32
34
|
- lib/xml-object/adapters
|
33
|
-
- lib/xml-object/adapters/hpricot.rb
|
34
35
|
- lib/xml-object/adapters/libxml.rb
|
35
36
|
- lib/xml-object/adapters/rexml.rb
|
36
37
|
- lib/xml-object/adapters.rb
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'hpricot'
|
3
|
-
|
4
|
-
module XMLObject::Adapters::Hpricot
|
5
|
-
|
6
|
-
# Can take a String of XML data, or anything that responds to
|
7
|
-
# either +read+ or +to_s+.
|
8
|
-
def self.new(duck)
|
9
|
-
case
|
10
|
-
when duck.respond_to?(:read)
|
11
|
-
then Element.new(::Hpricot::XML(duck.read).root)
|
12
|
-
when duck.respond_to?(:to_s)
|
13
|
-
then Element.new(::Hpricot::XML(duck.to_s).root)
|
14
|
-
else raise "Don't know how to deal with '#{duck.class}' object"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
private ##################################################################
|
19
|
-
|
20
|
-
class Element < XMLObject::Adapters::Base::Element # :nodoc:
|
21
|
-
def initialize(xml)
|
22
|
-
@raw, @name = xml, xml.name
|
23
|
-
@attributes = xml.attributes || {}
|
24
|
-
|
25
|
-
@element_nodes = xml.children.select { |c| c.elem? }
|
26
|
-
|
27
|
-
@text_nodes = xml.children.select do |c|
|
28
|
-
c.text? && !c.is_a?(::Hpricot::CData)
|
29
|
-
end.map! { |c| c.to_s }
|
30
|
-
|
31
|
-
@cdata_nodes = xml.children.select do |c|
|
32
|
-
c.is_a? ::Hpricot::CData
|
33
|
-
end.map! { |c| c.to_s }
|
34
|
-
|
35
|
-
super
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
::XMLObject.adapter = ::XMLObject::Adapters::Hpricot
|