XML parser accepts text before top-level tag if provided in entity form
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=5965
Reported by Jonas Wallden jonasw@roxen.com
> Parser.XML.Simple()->parse(" A <foo/>", lambda(mixed ...foo) { werror("%O\n", foo); });
({ /* 5 elements */
"error",
0,
0,
"All data must be inside tags",
([ /* 1 element */
"location": 2
])
})
({ /* 5 elements */
"<>",
"foo",
([ ]),
0,
([ /* 1 element */
"location": 11
])
})
> Parser.XML.Simple()->parse(" A <foo/>", lambda(mixed ...foo) { werror("%O\n", foo); });
({ /* 5 elements */
"",
0,
0,
"A",
([ /* 1 element */
"location": 9
])
})
({ /* 5 elements */
"<>",
"foo",
([ ]),
0,
([ /* 1 element */
"location": 15
])
})
(Haven't checked the XML spec but I doubt it's the intended behavior.)