create a DOCTYPE element with JAXP

A

Abs

Hi!

I need to build a HTML file using JAXP. Right now, I'm using the
following code:

---------
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
DOMImplementation impl = builder.getDOMImplementation();

DocumentType htmltype=impl.createDocumentType("html","-//W3C//DTD HTML
4.01 Transitional//EN","http://www.w3.org/TR/html4/loose.dtd");
Document doc = impl.createDocument("html", "html", htmltype);

// fill document
---------



The document is built correctly but the DOCTYPE tag doesn't appear. What
am I doing wrong ?

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top