michaelrsweet / mxml

Tiny XML library.
https://www.msweet.org/mxml
Apache License 2.0
428 stars 157 forks source link

commit a084198be8e0278513c7fa1677442e4312a794ac breaks applications #259

Closed LordOfDragons closed 4 years ago

LordOfDragons commented 4 years ago

This commit today broke our application. The standard states that the <?xml is optional in xml version 1.0 . So far we used a check if the returned element is the xml declaration (with the actual xml node as child) or the actual xml node itself.

Because this commit contradicts the XML standard I would kindly request to revert the commit or to make this behaviour configurable (and disabled by default).

Reference: https://www.w3.org/TR/xml/#sec-prolog-dtd

michaelrsweet commented 4 years ago

Hmm, investigating - this is the #1 issue with users of Mini-XML trying to load documents that are not well-formed...

LordOfDragons commented 4 years ago

Well, according to xml standard no character is allowed to show up before <?xml or a well-formed node. I think using the check " is '<?xml' or '<'" instead of "is '<?xml' " should help both cases

michaelrsweet commented 4 years ago

OK, I'll pull the requirement for <?xml at the start but not < (i.e. the first character needs to be <).

michaelrsweet commented 4 years ago

[master e2f7978] Roll back part of the change for Issue #256 since it causes a regression for some applications and the XML 1.0 specification only requires an XML file to start with '<' (Issue #259)