| I mentioned this issue in the xalan list.
If you don't want to use the deprecated xerces serializer you can filter out the whitespace first. This filter was already mentioned in the forum which can be set on the serializer: static LSSerializerFilter skipWhitespaceFilter = new LSSerializerFilter() { public short acceptNode(Node n) { if (n.getNodeType() == Node.TEXT_NODE) { return (n.getNodeValue().trim().length() == 0) ? FILTER_REJECT : FILTER_ACCEPT; } return FILTER_ACCEPT; }
public int getWhatToShow() { return NodeFilter.SHOW_ALL; }
public short startElement(Element elem) { return FILTER_ACCEPT; } };
You may want this filter more precise by filtering out only the whitespace in mixed content nodes.
Regards Dick Deneer
Op 5-apr-2007, om 19:04 heeft Rafał Gierusz het volgende geschreven: I'm using Xerces 2.9.0. any idea about this version and my problem? Should I use other mailing list (xalan)?
Michael Glavassevich wrote: You haven't said what release you tried this with (assuming it's Xerces). Note that "format-pretty-print" has only been implemented since Xerces 2.8.0. If you're using Xerces 2.9.0 the LSSerializer is based on Xalan which has different behaviour with respect to pretty-printing.
Hello,
I would like to make "pretty-print" xml using LSSerializer, so a write:
LSSerializer serializer = ... serializer.getDomConfig().setParameter("format-pretty-print", true);
then I get string with "pretty-print" xml using metod: serializer.writeToString(... DOMDocument ...));
and the result is:
<b> <z:c/>
</b> </a>
whitespaces inside "<b>" tag are not removed (after "<z:c/>" tag). Does anyone know how to remove this whitespaces?
---------------------------------------------------------------------
|
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|