File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ class BaseParser
61
61
XMLDECL_PATTERN = /<\? xml\s +(.*?)\? >/um
62
62
INSTRUCTION_START = /\A <\? /u
63
63
INSTRUCTION_PATTERN = /<\? #{ NAME } (\s +.*?)?\? >/um
64
- TAG_MATCH = /^ <((?>#{ QNAME_STR } ))/um
64
+ TAG_MATCH = /\A <((?>#{ QNAME_STR } ))/um
65
65
CLOSE_MATCH = /^\s *<\/ (#{ QNAME_STR } )\s *>/um
66
66
67
67
VERSION = /\b version\s *=\s *["'](.*?)['"]/um
Original file line number Diff line number Diff line change @@ -46,6 +46,19 @@ def test_empty_namespace_attribute_name
46
46
47
47
DETAIL
48
48
end
49
+
50
+ def test_garbage_less_than_before_root_element_at_line_start
51
+ exception = assert_raise ( REXML ::ParseException ) do
52
+ parse ( "<\n <x/>" )
53
+ end
54
+ assert_equal ( <<-DETAIL . chomp , exception . to_s )
55
+ malformed XML: missing tag start
56
+ Line: 2
57
+ Position: 6
58
+ Last 80 unconsumed characters:
59
+ < <x/>
60
+ DETAIL
61
+ end
49
62
end
50
63
end
51
64
end
You can’t perform that action at this time.
0 commit comments