[XML-SIG] Missing DOCTYPE when pretty printing

Jeremy Kloth jeremy.kloth@fourthought.com
Mon, 05 Mar 2001 17:01:23 -0700


"Martin v. Loewis" wrote:
> 
> > 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?

According to the doctypedecl, the answer would be yes.  The ExternalID
is optional and so is the internal subset.  Both are followed by a
question mark.

-- 
Jeremy Kloth                             Consultant
jeremy.kloth@fourthought.com             (303)583-9900 x 105
Fourthought, Inc.                        http://www.fourthought.com
Software-engineering, knowledge-management, XML, CORBA, Linux, Python