You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Downey, Tim" <td...@Tilion.com> on 2000/10/10 19:07:50 UTC
Extracting the DOCTYPE from a DOM
Hi gang,
This must have been asked before, but I can't seem to find any reference in
the archive.
I'm creating a document using DOM and then attempting to serialize it out to
a stream for transmission. I think I'm correctly setting the DOCTYPE, but
no matter what I do, I can't get the serialized form to contain the DOCTYPE
line.
Here's a snippet of the code that creates the document and the DOCTYPE
DOMImplementation domImpl =
DOMImplementationImpl.getDOMImplementation();
DocumentType docType = domImpl.createDocumentType("qualifiedName",
"publicId",
"systemId");
Document doc = domImpl.createDocument("urn:art-org:art", "art",
docType);
Here's where I serialize:
try{
OutputFormat format = new OutputFormat(doc);
XMLSerializer xSer = new XMLSerializer(System.out,format);
xSer.asDOMSerializer();
xSer.serialize(doc.getDocumentElement());
} catch (IOException i){ }
I've also tried using the DOMWriter sample code with no luck. Is there any
way to extract the DOCTYPE from a DOM?
Thanks a lot
-tim
++++++++++++++++++++++++++++++++++++++++++++
Tim Downey Tilion,
Inc.
(978)461-4800 x243 5 Clock Tower Place, Suite 110
tdowney@tilion.com Maynard, MA 01754
<<Tim Downey (E-mail).vcf>>