In the latest version (9.4?) I noticed a change to XMLIndenter.
It now adds a newline at the end of documents.
@Override
public void endDocument() throws XPathException {
if (afterEndTag) {
characters("\n", 0, 0); // if permitted, output a trailing newline, for tidier
console output
}
super.endDocument();
This makes some sense but I suggest the old behaviour is better and that
adding newlines should be done at the application level.
Why ? Well this broke xmlsh :) Why ?
What if you are serializeing a sequence of short documents. Say an xquery
The rationale is explained in the comment; it leads to tidier output when
you're writing to System.out and something else follows. I'm afraid it's not
going to be possible to please everyone all the time with this kind of thing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the latest version (9.4?) I noticed a change to XMLIndenter.
It now adds a newline at the end of documents.
@Override
public void endDocument() throws XPathException {
if (afterEndTag) {
characters("\n", 0, 0); // if permitted, output a trailing newline, for tidier
console output
}
super.endDocument();
This makes some sense but I suggest the old behaviour is better and that
adding newlines should be done at the application level.
Why ? Well this broke xmlsh :) Why ?
What if you are serializeing a sequence of short documents. Say an xquery
,,<c/>
These are now serialized as
<c/>
when before it was
<c/>
This probably falls outside of the specs but I suggest this level of control
should reside at the app layer not the library.
As a workaround it was fairly easy for me to derive from XMLIndenter to get
rid of the spurious newline.
-David
The rationale is explained in the comment; it leads to tidier output when
you're writing to System.out and something else follows. I'm afraid it's not
going to be possible to please everyone all the time with this kind of thing.