aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/rexml/element.rb7
-rw-r--r--lib/rexml/parsers/baseparser.rb5
-rw-r--r--lib/rexml/parsers/treeparser.rb2
-rw-r--r--lib/rexml/rexml.rb4
-rw-r--r--lib/rexml/xpath_parser.rb19
5 files changed, 23 insertions, 14 deletions
diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb
index 27886a90bc..25e530de41 100644
--- a/lib/rexml/element.rb
+++ b/lib/rexml/element.rb
@@ -74,10 +74,9 @@ module REXML
rv << " "
attr.write( rv, 0 )
end
- rv << ">"
if children.size > 0
- rv << " ... </>"
+ rv << "> ... </>"
else
rv << "/>"
end
@@ -976,6 +975,10 @@ module REXML
return nil
end
+ def to_a
+ values.flatten
+ end
+
# Returns the number of attributes the owning Element contains.
# doc = Document "<a x='1' y='2' foo:x='3'/>"
# doc.root.attributes.length #-> 3
diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb
index 16e5c80237..e95cba8904 100644
--- a/lib/rexml/parsers/baseparser.rb
+++ b/lib/rexml/parsers/baseparser.rb
@@ -306,8 +306,9 @@ module REXML
last_tag = @tags.pop
#md = @source.match_to_consume( '>', CLOSE_MATCH)
md = @source.match( CLOSE_MATCH, true )
- raise REXML::ParseException.new( "Missing end tag for '#{last_tag}' "+
- "(got \"#{md[1]}\")", @source) unless last_tag == md[1]
+ raise REXML::ParseException.new( "Missing end tag for "+
+ "'#{last_tag}' (got \"#{md[1]}\")",
+ @source) unless last_tag == md[1]
return [ :end_element, last_tag ]
elsif @source.buffer[1] == ?!
md = @source.match(/\A(\s*[^>]*>)/um)
diff --git a/lib/rexml/parsers/treeparser.rb b/lib/rexml/parsers/treeparser.rb
index 931da73025..57d11f7e23 100644
--- a/lib/rexml/parsers/treeparser.rb
+++ b/lib/rexml/parsers/treeparser.rb
@@ -1,3 +1,5 @@
+require 'rexml/validation/validationexception'
+
module REXML
module Parsers
class TreeParser
diff --git a/lib/rexml/rexml.rb b/lib/rexml/rexml.rb
index 5bdc0bb867..bf905b20e2 100644
--- a/lib/rexml/rexml.rb
+++ b/lib/rexml/rexml.rb
@@ -21,7 +21,7 @@
# online[http://www.germane-software.com/software/rexml/docs/tutorial.html]
module REXML
Copyright = "Copyright © 2001, 2002, 2003, 2004 Sean Russell <ser@germane-software.com>"
- Date = "+2004/162"
- Version = "3.1.1"
+ Date = "+2004/186"
+ Version = "3.1.2"
end
diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb
index ce6cec5374..5a976d5e82 100644
--- a/lib/rexml/xpath_parser.rb
+++ b/lib/rexml/xpath_parser.rb
@@ -151,13 +151,14 @@ module REXML
end
end
when :any
+ #puts "ANY"
for element in nodeset
if element.node_type == :element
- attr = element.attributes
+ new_nodeset += element.attributes.to_a
end
end
end
- #puts "RETURNING #{new_nodeset.collect{|n|n.to_s}.inspect}"
+ #puts "RETURNING #{new_nodeset.collect{|n|n.to_s}.inspect}"
return new_nodeset
when :parent
@@ -182,7 +183,7 @@ module REXML
new_nodeset << node
while ( node.parent )
node = node.parent
- new_nodeset << node unless new_nodeset.includes? node
+ new_nodeset << node unless new_nodeset.include? node
end
end
end
@@ -429,10 +430,9 @@ module REXML
end
def equality_relational_compare( set1, op, set2 )
- #puts "EQ_REL_COMP: #{set1.to_s}, #{op}, #{set2.to_s}"
- #puts "#{set1.class.name} #{op} #{set2.class.name}"
+ #puts "#"*80
if set1.kind_of? Array and set2.kind_of? Array
- #puts "#{set1.size} & #{set2.size}"
+ #puts "#{set1.size} & #{set2.size}"
if set1.size == 1 and set2.size == 1
set1 = set1[0]
set2 = set2[0]
@@ -450,6 +450,7 @@ module REXML
return false
end
end
+ #puts "EQ_REL_COMP: #{set1.class.name} #{set1.inspect}, #{op}, #{set2.class.name} #{set2.inspect}"
#puts "COMPARING VALUES"
# If one is nodeset and other is number, compare number to each item
# in nodeset s.t. number op number(string(item))
@@ -458,7 +459,7 @@ module REXML
# If one is nodeset and other is boolean, compare boolean to each item
# in nodeset s.t. boolean op boolean(item)
if set1.kind_of? Array or set2.kind_of? Array
- #puts "ISA ARRAY"
+ #puts "ISA ARRAY"
if set1.kind_of? Array
a = set1
b = set2.to_s
@@ -485,8 +486,10 @@ module REXML
return true if compare( v, op, b )
end
else
+ #puts "Functions::string( #{b}(#{b.class.name}) ) = #{Functions::string(b)}"
b = Functions::string( b )
for v in a
+ #puts "v = #{v.class.name} #{v.inspect}"
v = Functions::string(v)
return true if compare( v, op, b )
end
@@ -529,7 +532,7 @@ module REXML
end
def compare a, op, b
- #puts "COMPARE #{a.to_s} #{op} #{b.to_s}"
+ #puts "COMPARE #{a.to_s}(#{a.class.name}) #{op} #{b.to_s}(#{a.class.name})"
case op
when :eq
a == b