S Uma wrote: > Hello, > > How to create a 'doc type' line in xml document using DOM Parser APIs. > When createDocumentType() is used, it does not write the given doc type. > > Any ideas? > >
This is working in my application. I hope it does what you need // creates a new document with the right dtd name DocumentType documentType = new DocumentTypeImpl (null, null, null, dtdName); document = new DocumentImpl(documentType); // put into the new document the nodes of the old one while (oldDocument.hasChildNodes()) { Node child = oldDocument.getFirstChild(); // do not adopt the documenttype if (child instanceof DocumentType) { oldDocument.removeChild(child); } else { document.adoptNode(child); document.appendChild(child); } } Sebastien --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]