diff options
| author | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-08 02:03:44 +0000 |
|---|---|---|
| committer | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-08 02:03:44 +0000 |
| commit | ed71c064d5162f269336f3baed43c28aafd76094 (patch) | |
| tree | 5e6ceeb9a9fcb13bfba05d7eef0b49d398f78a76 /lib/rexml/parsers | |
| parent | d9dfe3ad2b1d51a3217a02353662dd211e9adf7d (diff) | |
| download | ruby-ed71c064d5162f269336f3baed43c28aafd76094.tar.gz ruby-ed71c064d5162f269336f3baed43c28aafd76094.tar.xz ruby-ed71c064d5162f269336f3baed43c28aafd76094.zip | |
Merged changes into HEAD from REXML 3.1.5.
The list of bug fixes/enhancements is at:
http://www.germane-software.com/projects/rexml/query?status=closed&milestone=3.1.5
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/parsers')
| -rw-r--r-- | lib/rexml/parsers/baseparser.rb | 13 | ||||
| -rw-r--r-- | lib/rexml/parsers/xpathparser.rb | 8 |
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb index bce4ba4c2..2cfcf0230 100644 --- a/lib/rexml/parsers/baseparser.rb +++ b/lib/rexml/parsers/baseparser.rb @@ -96,6 +96,13 @@ module REXML "apos" => [/'/, "'", "'", /'/] } + + ###################################################################### + # These are patterns to identify common markup errors, to make the + # error messages more informative. + ###################################################################### + MISSING_ATTRIBUTE_QUOTES = /^<#{NAME_STR}\s+#{NAME_STR}\s*=\s*[^"']/um + def initialize( source ) self.stream = source end @@ -335,7 +342,11 @@ module REXML else # Get the next tag md = @source.match(TAG_MATCH, true) - raise REXML::ParseException.new("malformed XML: missing tag start", @source) unless md + unless md + # Check for missing attribute quotes + raise REXML::ParseException.new("missing attribute quote", @source) if @source.match(MISSING_ATTRIBUTE_QUOTES ) + raise REXML::ParseException.new("malformed XML: missing tag start", @source) + end attrs = [] if md[2].size > 0 attrs = md[2].scan( ATTRIBUTE_PATTERN ) diff --git a/lib/rexml/parsers/xpathparser.rb b/lib/rexml/parsers/xpathparser.rb index 6bac852d6..6f5b21cd9 100644 --- a/lib/rexml/parsers/xpathparser.rb +++ b/lib/rexml/parsers/xpathparser.rb @@ -596,7 +596,13 @@ module REXML parsed << :function parsed << fname path = FunctionCall(path, parsed) - when LITERAL, NUMBER + when NUMBER + #puts "LITERAL or NUMBER: #$1" + varname = $1.nil? ? $2 : $1 + path = $' + parsed << :literal + parsed << (varname.include?('.') ? varname.to_f : varname.to_i) + when LITERAL #puts "LITERAL or NUMBER: #$1" varname = $1.nil? ? $2 : $1 path = $' |
