1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

REXML changes

* The main purpose for this change is to get a fix in for nasty bug in XPath.
  In the new code for the descendant-or-self axis, the document order code
  was calling the wrong method to do node comparisons, causing a terrible
  overhead that slowed the axis down to the point where it was unusable.
  This is a common axis, also known as '//', so this fix is critical.
* Using Element#text= on a non-Text, non-String argument caused an error.
  this has been changed so that the behavior is like puts() -- to_s() is
  called on the object first.
* refactored the pretty-printing code a little.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ser 2004-04-02 03:57:03 +00:00
parent 7a07ba45a0
commit 0bb5cc28e4
4 changed files with 12 additions and 7 deletions

View file

@ -455,7 +455,12 @@ module REXML
# doc.root.text = 'Russell' #-> '<a><b/>Russell<c/></a>' # doc.root.text = 'Russell' #-> '<a><b/>Russell<c/></a>'
# doc.root.text = nil #-> '<a><b/><c/></a>' # doc.root.text = nil #-> '<a><b/><c/></a>'
def text=( text ) def text=( text )
text = Text.new( text, whitespace(), nil, raw() ) if text.kind_of? String if text.kind_of? String
text = Text.new( text, whitespace(), nil, raw() )
else
text = Text.new( text.to_s, whitespace(), nil, raw() ) unless text.kind_of? Text
end
old_text = get_text old_text = get_text
if text.nil? if text.nil?
old_text.remove unless old_text.nil? old_text.remove unless old_text.nil?

View file

@ -1 +1 @@
require 'rexml/encodings/SHIFT-JIS' require 'rexml/encodings/Shift-JIS'

View file

@ -2,8 +2,8 @@
# #
# URL: http://www.germane-software.com/software/rexml # URL: http://www.germane-software.com/software/rexml
# Author: Sean Russell <ser@germane-software.com> # Author: Sean Russell <ser@germane-software.com>
# Version: @ANT_VERSION@ # Version: 3.0.1
# Date: @ANT_DATE@ # Date: +2004/093
@ -21,6 +21,6 @@
# A tutorial is available in docs/tutorial.html # A tutorial is available in docs/tutorial.html
module REXML module REXML
Copyright = "Copyright © 2001, 2002, 2003, 2004 Sean Russell <ser@germane-software.com>" Copyright = "Copyright © 2001, 2002, 2003, 2004 Sean Russell <ser@germane-software.com>"
Date = "+2004/088" Date = "+2004/093"
Version = "3.0.0" Version = "3.0.1"
end end

View file

@ -321,7 +321,7 @@ module REXML
node_idx = [] node_idx = []
np = node.node_type == :attribute ? node.element : node np = node.node_type == :attribute ? node.element : node
while np.parent and np.parent.node_type == :element while np.parent and np.parent.node_type == :element
node_idx << np.parent.children.index( np ) node_idx << np.parent.index( np )
np = np.parent np = np.parent
end end
new_arry << [ node_idx.reverse.join, node ] new_arry << [ node_idx.reverse.join, node ]