[jdom-interest] Patch: JDOM white space probelm

Jason Hunter jhunter at acm.org
Wed Feb 26 12:55:24 PST 2003


Brad, what's the purpose of moving up the line separator print?

-jh-

"Bradley S. Huffman" wrote:
> 
> Here's a patch to XMLOutputter that should fix the problem.  It
> also moves the printing of line seperator after doctype up to
> output(Document,Writer).
> 
> Since we don't have a unit test to throughly test XMLOutputter, try the
> patch for a couple days and let's us know if it introduces any problems.
> Right now I can only run it on a simple test, which seems to work just
> fine.
> 
> Brad
> 
> *** XMLOutputter.old    Tue Feb 25 09:26:37 2003
> --- XMLOutputter.java   Tue Feb 25 09:49:33 2003
> ***************
> *** 667,672 ****
> --- 667,676 ----
> 
>           if (doc.getDocType() != null) {
>               printDocType(doc.getDocType(), out);
> +
> +             // Always print line separator after declaration, helps the
> +             // output look better and is semantically inconsequential
> +             out.write(currentFormat.lineSeparator);
>           }
> 
>           // Print out root element, as well as any root level
> ***************
> *** 1039,1048 ****
>               out.write("]");
>           }
>           out.write(">");
> -
> -         // Always print line separator after declaration, helps the
> -         // output look better and is semantically inconsequential
> -         out.write(currentFormat.lineSeparator);
>       }
> 
>       /**
> --- 1043,1048 ----
> ***************
> *** 1522,1529 ****
>           int size = content.size();
>           if (currentFormat.trimAllWhite
>                   || currentFormat.textNormalize
> !                 || currentFormat.textTrim
> !                 || currentFormat.newlines) {
>               while( index < size) {
>                   if ( !isAllWhitespace( content.get(index))) {
>                       return index;
> --- 1522,1528 ----
>           int size = content.size();
>           if (currentFormat.trimAllWhite
>                   || currentFormat.textNormalize
> !                 || currentFormat.textTrim) {
>               while( index < size) {
>                   if ( !isAllWhitespace( content.get(index))) {
>                       return index;
> ***************
> *** 1547,1554 ****
>           int index = start;
>           if (currentFormat.trimAllWhite
>                   || currentFormat.textNormalize
> !                 || currentFormat.textTrim
> !                 || currentFormat.newlines) {
>               while( index >= 0) {
>                   if ( !isAllWhitespace( content.get(index - 1)))
>                       break;
> --- 1546,1552 ----
>           int index = start;
>           if (currentFormat.trimAllWhite
>                   || currentFormat.textNormalize
> !                 || currentFormat.textTrim) {
>               while( index >= 0) {
>                   if ( !isAllWhitespace( content.get(index - 1)))
>                       break;
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list