[XML-SIG] DOCTYPEs question with 4DOM

Thomas B. Passin tpassin at comcast.net
Wed Jul 7 04:04:13 CEST 2004

Derek Fountain wrote:

> According to my book (Inside XML, New Riders) a document type declaration can 
> have one of several forms:
> <!DOCTYPE rootname [DTD]>
> <!DOCTYPE rootname SYSTEM url>
> <!DOCTYPE rootname SYSTEM url [DTD]>
> <!DOCTYPE rootname PUBLIC identifier>
> <!DOCTYPE rootname PUBLIC identifier [DTD]>

Not quite ... the XML Rec requires a system identifier even when there 
is a PUBLIC keyword and identifier.

> According to the DOM Level 3 specification, the createDocumentType method of 
> the DOMImplementation interface takes 3 parameters: qualified name, publicId 
> and systemId. I would have thought that rootname is the qualified name, 
> publicId is the identifier (in the last two cases) and systemId is the url 
> (in the 2nd and 3rd cases). I could be wrong, but that made sense. :o}
> I want to create a doctype like this:
> <!DOCTYPE test>
> and this:
> docType =  implementation.createDocumentType( "1", "test", "2" )
> produces:
> <!DOCTYPE storage PUBLIC "test" "2">
> with the "1" nowhere to be seen.
> I have no idea what is going on. Can someone explain? Thanks! :o)

I can see how it would not know what to do with the "1", since it cannot 
be a legal element name, but some of those outputs look pretty strange, 
don't they?  But what version of the PyXML package are you using?  I 
just created document types like yours and they at least had the proper 
sytem and public IDs (I did not serialize anything, though)


Tom P

Thomas B. Passin
Explorer's Guide to the Semantic Web (Manning Books)

More information about the XML-SIG mailing list