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 Etienne Deleflie <et...@proxima-tech.com> on 2003/05/05 10:12:58 UTC

no propagation of DOCTYPE declaration

Hello,

I am manipulating log4j.xml file programmatically.

- I read a "core" log4j.xml file which contains a DOCTYPE declaration, 
aand a basic set of log4j configuration parameters.
- I modify that xml structure
- I then write it out again.

when I write it out, the DOCTYPE declaration has gone.... which means 
that log4j complains, and does not get configured properly.

I have tried using all sorts of overly complex DomImplementationImpl 
objects to set the DOCTYPE on a new Document, and then append all my 
existing xml tree, but still, the DOCTYPE is never there.

I see lots of docs about jDOM having a setDocType() method ...... JAXP 
does not seem to have this.

How can I either keep, or append a new DocumentType object, when I write 
the DOcument out to file ?

can anyone help ?





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: no propagation of DOCTYPE declaration

Posted by Neeraj Bajaj <ne...@sun.com>.
Etienne Deleflie wrote:

> Hello,
>
> I am manipulating log4j.xml file programmatically.
>
> - I read a "core" log4j.xml file which contains a DOCTYPE declaration,
> aand a basic set of log4j configuration parameters.
> - I modify that xml structure
> - I then write it out again.
>
> when I write it out, the DOCTYPE declaration has gone.... which means
> that log4j complains, and does not get configured properly.
>
> I have tried using all sorts of overly complex DomImplementationImpl
> objects to set the DOCTYPE on a new Document, and then append all my
> existing xml tree, but still, the DOCTYPE is never there.
>
> I see lots of docs about jDOM having a setDocType() method ...... JAXP
> does not seem to have this.

                    you can use JAXP TransformerFactoryImpl [1] to
transform the in memory DOM or SAX events etc. When transforming you should
set the output properties [2] (DOCTYPE_PUBLIC, DOCTYPE_SYSTEM) for a
Transformer [3]

[1]
http://java.sun.com/webservices/docs/1.1/api/javax/xml/transform/TransformerFactory.html

[2]http://java.sun.com/webservices/docs/1.1/api/javax/xml/transform/OutputKeys.html

[3]
http://java.sun.com/webservices/docs/1.1/api/javax/xml/transform/Transformer.html

Neeraj


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org