Skip to content

Commit 41c5143

Browse files
author
Terry Reese
committed
Added support for libxml-ruby 0.8 branch...support for libxml-ruby 0.3.x branch retained.
1 parent f5ae751 commit 41c5143

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v0.0.9 Tue Aug 12, 2008
2+
- change to xpath.rb file to add support to libxml-ruby 0.8+ branch.
3+
14
v0.0.6 Tue Jun 5, 2007
25
- change to resumption token location in the response, to better conform to the specification.
36
- oai shell date parsing should now be working correctly.

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
RUBY_OAI_VERSION = '0.0.8'
1+
RUBY_OAI_VERSION = '0.0.9'
22

33
require 'rubygems'
44
require 'rake'

lib/oai/xpath.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ def get_attribute(node, attr_name)
3737
case node.class.to_s
3838
when 'REXML::Element'
3939
return node.attribute(attr_name)
40-
when 'XML::Node'
41-
return node.property(attr_name)
40+
when 'LibXML::XML::Node'
41+
#There has been a method shift between 0.5 and 0.7
42+
if defined?(node.property) == nil
43+
return node.attributes[attr_name]
44+
else
45+
return node.property(attr_name)
46+
end
4247
end
4348
return nil
4449
end
@@ -48,11 +53,11 @@ def get_attribute(node, attr_name)
4853
# figure out what sort of object we should do xpath on
4954
def parser_type(x)
5055
case x.class.to_s
51-
when 'XML::Document'
56+
when 'LibXML::XML::Document'
5257
return 'libxml'
53-
when 'XML::Node'
58+
when 'LibXML::XML::Node'
5459
return 'libxml'
55-
when 'XML::Node::Set'
60+
when 'LibXML::XML::Node::Set'
5661
return 'libxml'
5762
when 'REXML::Element'
5863
return 'rexml'

0 commit comments

Comments
 (0)