[EMAIL PROTECTED] wrote:
> I need to change/assign DTD in a DOM object, so I'm creating a new
> document with a doctype I need and copying all the children of the root
> node. Does anybody know if there is a better and less expensive way to
> modify or set DOCTYPE in an existing document?

The doctype is just the first child of the document (for wellformness
reasons it must appear before documentElement). 
So the following trick will do:
1. document.removeChild (document.getDoctype())
2. create a new doctype using DOMImplementation
3. document.insertBefore (newDoctype, document.getDocumentElement())

However, this trick will only work with the latest code from CVS for
Xerces2 (thanks to Arnaud Le Hors).
You may try it for Xerces 1, however you might get exception..

Hope it helps,
-- 
Elena Litani / IBM Toronto

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to