You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Hai-Bang Pham <Ha...@marshmc.com> on 2000/01/24 18:55:22 UTC

[question] Why is the doctype not set?

Hello,

I'm currently working with Xerces-J v1.0.1 and I can't seem to set a 
doctype in a new document i.e.

...
//new DocumentTypeImpl(ownerDoc, name, publicID, systemId);
DocumentType docType = new DocumentTypeImpl( null, "TAG", null, 
"http://server/dtd/TAG.dtd" );
Document doc = new DocumentImpl( docType );
...

Inspecting the document type in doc gives null.

I've also tried doing it with the DOM level 2 API:

...
DOMImplementation DOMImpl = DOMImplementationImpl.
getDOMImplementation();
DocumentType docType = 
((DOMImplementationImpl)DOMImpl).createDocumentType("TAG", null, 
"http://server/dtd/TAG.dtd" );
Document doc = ((DOMImplementationImpl)DOMImpl).createDocument(null, 
"TAG", docType);
...

But the document type in doc is still null.

What I want to do is create a new document in memory that has the 
following structure:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE TAG SYSTEM "http://server/dtd/TAG.dtd">
...

Any help would be appreciated.  Thanks in advance.

-Hai