Hi 
I sent this mail friday morning
If someone as an answer, it would be great


-----Message d'origine-----
De : Sauquet Dominique [mailto:[EMAIL PROTECTED]
Envoy� : vendredi 28 f�vrier 2003 10:58
� : '[EMAIL PROTECTED]'
Objet : RE: xml.serialize.OutputFormat and preserveSpace


Hi
Considering the presentation of documents, I was using DOMWriter and as the 
   domWriter.setFeature("format-pretty-print",true) 
does not work (no effect at all)
(I am using Xerces 2-2)

With a DOMWriter how can you set the indentation, set the encoding or
omit XML declaration ?

I was then considering using XMLSerializer (which works for me)

Is there any advice you could give ?
What is the best practice between DOMWriter or XMLSerializer ?
One will it be more performant ?
more "in the standard way" ?

        Thanks
        Dominique




-----Message d'origine-----
De : Simon Kitching [mailto:[EMAIL PROTECTED]
Envoy� : jeudi 27 f�vrier 2003 22:10
� : [EMAIL PROTECTED]
Objet : xml.serialize.OutputFormat and preserveSpace


Hi,

I am having some problems serializing a DOM in the format I desire using
org.apache.xml.serialize.XMLSerializer (together with OutputFormat).

I generally want to "pretty print" the output, but don't want the
contents of text nodes to be rearranged as the serializer currently
does.

eg 
 <foo>
    <bar>this
is some
text   with   whitespace</bar>
 </foo>

Unfortunately, calling setPreserveSpace(false) on
org.apache.xml.serialize.OutputFormat causes the text content of node
<bar> to be flattened to a single line, then "wrapped" at the whim of
the pretty-printing code. And calling setPreserveSpace(true) basically
disables pretty-printing.

What I would like is for text nodes to be left alone. Text nodes
containing *only* whitespace can be stripped.

Is this possible to achieve?

I see that method setPreserveSpace The default is space stripping and
all elements that do not specify otherwise or use the default value will
not preserve spaces.

The setPreserveSpace javadoc contains the comment:
  "The default is space stripping and all elements that do not specify
otherwise or use the default value will not preserve spaces".
Does anyone know how you "specify otherwise" for a node?

I can use setCDataElements to cause the nodes I know will have
whitespace in them to be output as CDATA, but (a) I then need to specify
the set of nodes in advance, and (b) my client doesn't like this much.

Any info will be much appreciated..

Thanks,

Simon


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

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

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

Reply via email to