[XML-SIG] Missing DOCTYPE when pretty printing
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Mon, 5 Mar 2001 23:56:22 +0100
> Likely to be deliberate, because I don't think you can have a DOCTYPE
> without a system ID
Why is that? If the doctype only consists of an internal subset, then
there is nothing wrong with not having a system id, e.g. as in
<!DOCTYPE foo [
<!ELEMENT foo (bar*)>
<!ELEMENT bar (#PCDATA)>
]>
> <!DOCTYPE PUBLIC pubId systemId>
> <!DOCTYPE SYSTEM systemId>
I think the name of the root element is required. The syntax of
doctypedecl is
[28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S?
('[' (markupdecl | PEReference | S)* ']' S?)? '>'
where ExternalId is
[75] ExternalID ::= 'SYSTEM' S SystemLiteral |
'PUBLIC' S PubidLiteral S SystemLiteral
So you can't have a public ID without a system ID; you certainly can
have neither.
A related question: Is it well-formed to have neither system id nor
internal subset, i.e.
<!DOCTYPE foo>
If well-formed, can that ever appear in a valid document?
Regards,
Martin