n1tehawk/LuaXML

Attributes are incorrectly parsed if there's spaces around the "="

roddypratt opened this issue · 3 comments

OK:
<element attr="foo"/>

Fails :
<element attr = "foo"/>

I am not convinced that this is valid (= well-formed?) XML.

Consult the Extensible Markup Language (XML) 1.0 (Fifth Edition) reference for the logical structure of start tags and empty-element tags. [40], [41], and [44] are relevant here; and while [40] and [44] do contain (optional) whitespace «S» in the definitions for "opening" tags, the attribute definition [41] does not. It states an attribute to be the concatenation of «Name», «Eq», and «AttValue» - with no whitespace inbetween. In other words: the attribute name is immediately followed by the equal sign, immediately followed by the attribute value.

Regards, NiteHawk

But you are right that this should either parse, or be rejected with an appropriate error message.

Thanks for the link. But I think you've missed the definition of Eq (and, thus, S)

[25] Eq ::= S? '=' S?
[3] S ::= (#x20 | #x9 | #xD | #xA)+

IOW, Eq allows optional whitespace before and after the equals sign. I'd agree it's unusual, but it does appear to be conforming.