Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Extra white space escaping to preserve the infoset

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Bradley S. Huffman" <hip AT cs.okstate.edu>
  • To: John Cowan <jcowan AT reutershealth.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Extra white space escaping to preserve the infoset
  • Date: Tue, 08 Jul 2003 17:05:19 -0500

John Cowan writes:

> Bradley S. Huffman scripsit:
>
> > Hmmm, I could easily see users, for portablity, doing something like
> >
> > String line_seperator = System.getProperty("line.seperator");
> > ...
> > attribute.setValue("one and two" + line_sperator + "and three");
> > ...
> > serializer.setLineSeperator(line_seperator);
> >
> > and then wondering why the string is one char. longer on some systems then
> > on others.
>
> Because the line separator (a) is not the same on all systems, and (b)
> is not portable. When dealing with XOM, the right thing is \n, \n, and
> once again \n.

Then it better be documented! documented! and documented! Not only in
Serializer, but in every classes with a setValue method or equivalent, or
because of Murphy's Law, it will happen, and it will cause confusion.

This is one thing I've learned from the JDOM project, every time you try to
do something automagically it bites you big time. Best not to do it and
provide better documentation.

Brad




Archive powered by MHonArc 2.6.24.

Top of Page