diff options
author | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-01-20 03:56:02 +0000 |
---|---|---|
committer | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-01-20 03:56:02 +0000 |
commit | fa4bfa6af585589e4465831f1489fee83ce26f09 (patch) | |
tree | fabaa77b102a6a2b93bdb79b70c2fe5dfe21763e /lib/rexml/parsers | |
parent | f700c1354f19ca5ad73f4e119dcbff493a3e6e00 (diff) | |
download | ruby-fa4bfa6af585589e4465831f1489fee83ce26f09.tar.gz |
Merged from REXML main repository:
Fixes ticket:68.
NOTE that this involves an API change! Entity declarations in the doctype
now generate events that carry two, not one, arguments.
Implements ticket:15, using gwrite's suggestion. This allows Element to be
subclassed.
Two unrelated changes, because subversion is retarded and doesn't do
block-level commits:
1) Fixed a typo bug in previous change for ticket:15
2) Fixed namespaces handling in XPath and element.
***** Note that this is an API change!!! *****
Element.namespaces() now returns a hash of namespace mappings which are
relevant for that node.
Fixes a bug in multiple decodings
The changeset 1230:1231 was bad. The default behavior is *not* to use the
native REXML encodings by default, but rather to use ICONV by default. I know
that this will piss some people off, but defaulting to the pure Ruby version
isn't the correct solution, and it breaks other encodings, so I've reverted it.
* Fixes ticket:61 (xpath_parser)
* Fixes ticket:63 (UTF-16; UNILE decoding was bad)
* Cleans up some tests, removing opportunities for test corruption
* Improves parsing error messages a little
* Adds the ability to override the encoding detection in Source construction
* Fixes an edge case in Functions::string, where document nodes weren't
correctly converted
* Fixes Functions::string() for Element and Document nodes
* Fixes some problems in entity handling
Addresses ticket:66
Fixes ticket:71
Addresses ticket:78
NOTE: that this also fixes what is technically another bug in REXML. REXML's
XPath parser used to allow exponential notation in numbers. The XPath spec
is specific about what a number is, and scientific notation is not included.
Therefore, this has been fixed.
Cross-ported a fix for ticket:88 from CVS.
Fixes ticket:80
Documentation cleanup. Ticket:84
Applied Kou's fix for an un-trac'ed bug.
------------------------------------------------------------------------
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/parsers')
-rw-r--r-- | lib/rexml/parsers/baseparser.rb | 4 | ||||
-rw-r--r-- | lib/rexml/parsers/sax2parser.rb | 4 | ||||
-rw-r--r-- | lib/rexml/parsers/treeparser.rb | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb index c57ea58dc7..fecd801d6f 100644 --- a/lib/rexml/parsers/baseparser.rb +++ b/lib/rexml/parsers/baseparser.rb @@ -146,8 +146,6 @@ module REXML # Returns true if there are no more events def empty? - #STDERR.puts "@source.empty? = #{@source.empty?}" - #STDERR.puts "@stack.empty? = #{@stack.empty?}" return (@source.empty? and @stack.empty?) end @@ -365,8 +363,6 @@ module REXML else md = @source.match( TEXT_PATTERN, true ) if md[0].length == 0 - puts "EMPTY = #{empty?}" - puts "BUFFER = \"#{@source.buffer}\"" @source.match( /(\s+)/, true ) end #STDERR.puts "GOT #{md[1].inspect}" unless md[0].length == 0 diff --git a/lib/rexml/parsers/sax2parser.rb b/lib/rexml/parsers/sax2parser.rb index 61a216cec1..6c7fbe000a 100644 --- a/lib/rexml/parsers/sax2parser.rb +++ b/lib/rexml/parsers/sax2parser.rb @@ -16,6 +16,10 @@ module REXML @tag_stack = [] @entities = {} end + + def source + @parser.source + end def add_listener( listener ) @parser.add_listener( listener ) diff --git a/lib/rexml/parsers/treeparser.rb b/lib/rexml/parsers/treeparser.rb index 500a53f426..a53fa41925 100644 --- a/lib/rexml/parsers/treeparser.rb +++ b/lib/rexml/parsers/treeparser.rb @@ -23,7 +23,8 @@ module REXML case event[0] when :end_document unless tag_stack.empty? - raise ParseException.new("No close tag for #{tag_stack.inspect}") + #raise ParseException.new("No close tag for #{tag_stack.inspect}") + raise ParseException.new("No close tag for #{@build_context.xpath}") end return when :start_element |