Markup declarations in DOCTYPEs are parsed backwards‑incompatibly
ExE-Boss opened this issue · comments
Right now, XML1.0 parses:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (#PCDATA)>
<!ELEMENT other (#PCDATA)>
]>
<greeting>Hello, world!</greeting>
as
├ xml: version="1.0" encoding="UTF-8"
├ DOCTYPE: greeting
│ │ // Note that these are ignored by non‑validating parsers, eg. browsers:
│ ├ ELEMENT: greeting (#PCDATA)
│ └ ELEMENT: other (#PCDATA)
└ greeting
└ #text: Hello, world!
whereas XML5 parses it as:
├ xml: version="1.0" encoding="UTF-8"
├ DOCTYPE: greeting
├ #comment: ELEMENT other (#PCDATA)
├ #text: ]>
└ greeting
└ #text: Hello, world!
Since the XML5 parser seems to be intended to parse current XML while ignoring DTDs, this seems like it should parse as:
├ xml: version="1.0" encoding="UTF-8"
├ DOCTYPE: greeting
└ greeting
└ #text: Hello, world!
(The <!ELEMENT greeting (#PCDATA)>
and <!ELEMENT other (#PCDATA)>
entries are ignored)
Hm, that is troubling.
I'll see to update the xml5draft and xml5ever, probably over the weekend.
@ExE-Boss As a small question do you need DOCTYPE processing? And if yes, do you need Entity references?
I think entity references should be supported, given that they are extensively used within the Firefox browser’s XUL based UI.
Is XUL still a thing? I thought it was replaced by browser.html
Yes, XUL is still a thing and will be for at least a few more years.
On the plus side, XBL is almost dead.
We could start off with ignoring entities, and just making sure that an opening [
in a DOCTYPE
must be matched by a closing ]>
.