[jdom-interest] XMLOutputter and newlines afterdeclaration/doctype

Vadim.Strizhevsky at morganstanley.com Vadim.Strizhevsky at morganstanley.com
Thu Dec 19 08:37:59 PST 2002


Wow, and I thought this was a very inocent request. I really didn't
expect such a big discussion on this.

It is admittably a minor issue, and I'm achieving what I want in a
workaround. But you still have not presuaded me that JDOM way is
more correct. So without further ado lets try to beat this
horse just a little more...

On Thu, 19 Dec 2002, Elliotte Rusty Harold wrote:

> At 5:20 PM -0500 12/18/02, Vadim Strizhevsky wrote:
>
>
> >Logging. Test case generation/storage. Replay of daily xml messages.
> >Many different possible reasons for this. Yes there are other ways of
> >doing, yes you could store in separate files, yes you can still write
> >script that parse it, but it makes doing some things more complicated.
> >
>
> But why aren't you using an XML parser to handle these things?

1) Because its not valid XML as I desire to store multiple mesages in
single file.
2) performance.

In a specific concrete example I need to have a log of all messages that
went through the system per day,I then need an efficent/quick way to
replay these messages through the system. The system is fed messages over
the network, It doesn't make sense to read the file with XML parser as I
just need to send bytes over the wire. Something needs to read this
log and feed the system one message a time. Breaking the file apart on a
newline is easier/quicker than searching for <?xml... separation.


You present an argument of human readability. But in reality humans
don't actually read XML that much in my world. They usually use tools to
display the particular XML in custom/convinient way. However what
happens more often is that various systems/programs pass XML between them
over various media, (network, MQ, files, etc...) As far those system
concerned they don't care what it looks like, but may care how much space
it occupies. Yea 4bytes is not huge deal, but in principle you
trying to represent xml as concisely as possible, but you just can't
completely do it.



In general my real argument is logical. If I do the following:

outputter.setTextNormalize(true);
outputter.setNewLines(false);
outputter.setIndent(null);

I logically expect no pretty priting, and a single line out. But I don't
get that.


-Vadim


> --
>
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> |          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
> |              http://www.cafeconleche.org/books/xian2/              |
> |  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
> +----------------------------------+---------------------------------+
> |  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
> |  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
> +----------------------------------+---------------------------------+
>
>







More information about the jdom-interest mailing list