Thank you for your help. Things have become a bit clearer to me now.
I recognized the project I'm working on actually comes with
xercesImpl-2.8.1.jar. So I could bring the serialization to work with this
version of Xerces. I'm not sure if it will be possible to switch to 2.9.0.
I still get the serialize output on a single line using
org.apache.xerces.dom.DOMImplementationSourceImpl (2.8.1)!
-Felix
Michael Glavassevich-3 wrote:
>
>
> jfs <[EMAIL PROTECTED]> wrote on 11/16/2008 02:29:21 PM:
>
>> [...]
>> System.setProperty(DOMImplementationRegistry.PROPERTY,
>> "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
>
> This is Sun's implementation, not Xerces'. They forked the codebase a long
> time ago and have made many modifications to it that we would not know
> about here.
>
>> DOMImplementationRegistry registry =
>> DOMImplementationRegistry.newInstance();
>> DOMImplementationLS impl = (DOMImplementationLS)
>> registry.getDOMImplementation("LS");
>> LSOutput out = impl.createLSOutput();
>> out.setByteStream(res.getOutputStream());
>> LSSerializer writer = impl.createLSSerializer();
>> writer.write(xhtmlDoc, out);
>>
>> DOMImplementation implementation =
>> DOMImplementationRegistry.newInstance().getDOMImplementation("XML 3.0");
>> DOMImplementationLS feature = (DOMImplementationLS)
>> implementation.getFeature("LS", "3.0");
>> LSSerializer serializer = feature.createLSSerializer();
>> LSOutput output = feature.createLSOutput();
>> output.setByteStream(res.getOutputStream());
>> serializer.write(xhtmlDoc, output);
>> [...]
>>
>> (Leaving away "System.setProperty(...)" would cause getDOMImplementation
>> return NULL.)
>
> Probably a bug in the JDK and also a good indication that you don't
> actually have Xerces' jars on your classpath.
>
>> Output is still on a single line. I guess that this is caused by how I am
>> writing the serialized output to the servlet's response, rather then how
> the
>> serialization is configured. Do you have any ideas?
>
> Couldn't even guess what is happening here since you're not using the
> Apache implementation. In Xerces 2.9.0 we reimplemented the DOM Level 3
> serialization support on top of the Apache Xalan serializer
> (serializer.jar) and then deprecated the old XMLSerializer. Given when
> Sun's Java 5 and 6 were released I doubt either has anything based on the
> current implementation in it.
>
>> Thanks for your help!
>> -Felix
>
> Thanks.
>
> [1]
> http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/load-save.html#parameter-format-pretty-print
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: [EMAIL PROTECTED]
> E-mail: [EMAIL PROTECTED]
>
--
View this message in context:
http://www.nabble.com/No-newlines-in-DOM-serialization-tp20526791p20532041.html
Sent from the Xerces - J - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]