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

All of the tickets and issues mentioned in this log can be found at:

http://www.germane-software.com/projects/rexml/ticket/#

where '#' is the issue or ticket number.

* Fixes ticket:3 (Issue38 in Roundup.) However, this needs further testing.
* Fixed a couple of bugs in the SAX2 parser, plus a bunch of other changes I
  don't remember.
* More XPath ordering testing added
* Fixed the documentation WRT the raw mode of text nodes (ticket:4)
* Fixes roundup issue 43: substring-after bug.
  See: http://www.germane-software.com/cgi-bin/roundup/rexml/issue43
* Fixed issue44, Element#xpath
* Patch submitted by an anonymous doner to allow parsing of Tempfiles.  I was
  hoping that, by now, that whole Source thing would have been changed to use
  duck typing and avoid this sort of issue... but in the meantime, the patch
  has been applied.
* Fixes ticket:30, XPath default namespace bug.  The fix was provided
  by Lucas Nussbaum.
* Aliases #size to #length, as per zdennis's request.
* Fixes typo from previous commit
* Fixes ticket #32 (and adds a unit test)
* Merges a user-contributed patch for issue #40
* Changes Date, Version, and Copyright to upper case, to avoid conflicts with
  the Date class.
* Minor, yet incomplete, documentation changes.
* Resolves issue #34 (SAX parser change makes it impossible to parse IO feeds.)
* Moves parser.source.position() to parser.position()
* Improves the build script (less work for me to package a distribution)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ser 2005-12-30 16:35:45 +00:00
parent 2ffedb5f29
commit f8d68a2482
10 changed files with 47 additions and 31 deletions

View file

@ -713,7 +713,7 @@ module REXML
private
def __to_xpath_helper node
rv = node.expanded_name
rv = node.expanded_name.clone
if node.parent
results = node.parent.find_all {|n|
n.kind_of?(REXML::Element) and n.expanded_name == node.expanded_name

View file

@ -157,12 +157,9 @@ module REXML
# Kouhei fixed this too
def Functions::substring_after( string, test )
ruby_string = string(string)
ruby_index = ruby_string.index(string(test))
if ruby_index.nil?
test_string = string(test)
return $1 if ruby_string =~ /#{test}(.*)/
""
else
ruby_string[ ruby_index+1..-1 ]
end
end
# Take equal portions of Mike Stok and Sean Russell; mix

View file

@ -31,9 +31,11 @@ module REXML
end
def delete( object )
return unless @children.include? object
@children.delete object
object.parent = nil
found = false
@children.delete_if {|c|
c.equal?(object) and found = true
}
object.parent = nil if found
end
def each(&block)
@ -131,14 +133,15 @@ module REXML
@children.size
end
alias :length :size
# Replaces one child with another, making sure the nodelist is correct
# @param to_replace the child to replace (must be a Child)
# @param replacement the child to insert into the nodelist (must be a
# Child)
def replace_child( to_replace, replacement )
ind = @children.index( to_replace )
@children.map! {|c| c.equal?( to_replace ) ? replacement : c }
to_replace.parent = nil
@children[ind,0] = replacement
replacement.parent = self
end

View file

@ -128,6 +128,8 @@ module REXML
@source = source
elsif defined? StringIO and source.kind_of? StringIO
@source = IOSource.new(source)
elsif defined? Tempfile and source.kind_of? Tempfile
@source = IOSource.new(source)
else
raise "#{source.class} is not a valid input stream. It must be \n"+
"either a String, IO, StringIO or Source."
@ -139,6 +141,15 @@ module REXML
@entities = []
end
def position
if @source.respond_to? :position
@source.position
else
# FIXME
0
end
end
# Returns true if there are no more events
def empty?
#puts "@source.empty? = #{@source.empty?}"

View file

@ -32,6 +32,7 @@ module REXML
def_delegators( :@parser, :has_next? )
def_delegators( :@parser, :entity )
def_delegators( :@parser, :empty? )
def_delegators( :@parser, :source )
def initialize stream
@entities = {}

View file

@ -167,7 +167,7 @@ module REXML
:elementdecl, :cdata, :notationdecl, :xmldecl
handle( *event )
end
handle( :progress, @parser.source.position )
handle( :progress, @parser.position )
end
end

View file

@ -10,8 +10,8 @@
#
# Main page:: http://www.germane-software.com/software/rexml
# Author:: Sean Russell <serATgermaneHYPHENsoftwareDOTcom>
# Version:: 3.1.3
# Date:: 2005/224
# Version:: 3.1.3.1
# Date:: 2005/364
#
# This API documentation can be downloaded from the REXML home page, or can
# be accessed online[http://www.germane-software.com/software/rexml_doc]
@ -20,7 +20,7 @@
# or can be accessed
# 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 = "2005/224"
Version = "3.1.3"
Copyright = "Copyright © 2001-2005 Sean Russell <ser@germane-software.com>"
Date = "2005/364"
Version = "3.1.3.1"
end

View file

@ -8,11 +8,12 @@ module REXML
# @return a Source, or nil if a bad argument was given
def SourceFactory::create_from arg#, slurp=true
if arg.kind_of? String
source = Source.new(arg)
Source.new(arg)
elsif arg.kind_of? IO
source = IOSource.new(arg)
IOSource.new(arg)
elsif arg.kind_of? Source
arg
end
source
end
end
@ -199,7 +200,7 @@ module REXML
end
def position
@er_source.pos
@er_source.stat.pipe? ? 0 : @er_source.pos
end
# @return the current line in the source

View file

@ -39,8 +39,10 @@ module REXML
# text. If this value is nil (the default), then the raw value of the
# parent will be used as the raw value for this node. If there is no raw
# value for the parent, and no value is supplied, the default is false.
# Use this field if you have entities defined for some text, and you don't
# want REXML to escape that text in output.
# Text.new( "<&", false, nil, false ) #-> "&lt;&amp;"
# Text.new( "<&", false, nil, true ) #-> IllegalArgumentException
# Text.new( "<&", false, nil, true ) #-> Parse exception
# Text.new( "&lt;&amp;", false, nil, true ) #-> "&lt;&amp;"
# # Assume that the entity "s" is defined to be "sean"
# # and that the entity "r" is defined to be "russell"
@ -156,11 +158,11 @@ module REXML
# # Assume that the entity "s" is defined to be "sean", and that the
# # entity "r" is defined to be "russell"
# t = Text.new( "< & sean russell", false, nil, false, ['s'] )
# t.string #-> "< & sean russell"
# t.value #-> "< & sean russell"
# t = Text.new( "< & &s; russell", false, nil, false )
# t.string #-> "< & sean russell"
# t.value #-> "< & sean russell"
# u = Text.new( "sean russell", false, nil, true )
# u.string #-> "sean russell"
# u.value #-> "sean russell"
def value
@unnormalized if @unnormalized
doctype = nil

View file

@ -152,9 +152,10 @@ module REXML
#puts "IN QNAME"
prefix = path_stack.shift
name = path_stack.shift
ns = @namespaces[prefix]
ns = ns ? ns : ''
default_ns = @namespaces[prefix]
default_ns = default_ns ? default_ns : ''
nodeset.delete_if do |node|
ns = default_ns
# FIXME: This DOUBLES the time XPath searches take
ns = node.namespace( prefix ) if node.node_type == :element and ns == ''
#puts "NS = #{ns.inspect}"
@ -347,7 +348,7 @@ module REXML
preceding_siblings = all_siblings[ 0 .. current_index-1 ].reverse
#results += expr( path_stack.dclone, preceding_siblings )
end
nodeset = preceding_siblings
nodeset = preceding_siblings || []
node_types = ELEMENTS
when :preceding