summaryrefslogtreecommitdiff
path: root/lib/rexml/parsers
diff options
context:
space:
mode:
authorser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-30 16:35:45 +0000
committerser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-30 16:35:45 +0000
commitf8d68a248260e721bf756a17fcac6bf1e218e66f (patch)
tree38e048a85c10ebbe2b7cb84a61ae570ca26ba30a /lib/rexml/parsers
parent2ffedb5f291d8d420ff3a197bba62bd3b329a1db (diff)
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
Diffstat (limited to 'lib/rexml/parsers')
-rw-r--r--lib/rexml/parsers/baseparser.rb11
-rw-r--r--lib/rexml/parsers/pullparser.rb1
-rw-r--r--lib/rexml/parsers/sax2parser.rb2
3 files changed, 13 insertions, 1 deletions
diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb
index cb33a64908..c898ba0b60 100644
--- a/lib/rexml/parsers/baseparser.rb
+++ b/lib/rexml/parsers/baseparser.rb
@@ -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?}"
diff --git a/lib/rexml/parsers/pullparser.rb b/lib/rexml/parsers/pullparser.rb
index 09ac8948f6..36dc7160c3 100644
--- a/lib/rexml/parsers/pullparser.rb
+++ b/lib/rexml/parsers/pullparser.rb
@@ -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 = {}
diff --git a/lib/rexml/parsers/sax2parser.rb b/lib/rexml/parsers/sax2parser.rb
index f1b8246902..61a216cec1 100644
--- a/lib/rexml/parsers/sax2parser.rb
+++ b/lib/rexml/parsers/sax2parser.rb
@@ -167,7 +167,7 @@ module REXML
:elementdecl, :cdata, :notationdecl, :xmldecl
handle( *event )
end
- handle( :progress, @parser.source.position )
+ handle( :progress, @parser.position )
end
end