From ec847fad4e0c1b96c6cf91e7ff14ef0820f7ccc3 Mon Sep 17 00:00:00 2001 From: ser Date: Fri, 8 Sep 2006 02:03:44 +0000 Subject: 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@10888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rexml/parsers/baseparser.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/rexml/parsers/baseparser.rb') diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb index bce4ba4c20..2cfcf02308 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 ) -- cgit v1.2.3