[jdom-interest] patch for skipLeadingWhite

Bradley S. Huffman hip at a.cs.okstate.edu
Wed Apr 17 21:24:09 PDT 2002


Aaaa, you don't want to do that. skipLeadingWhite is used to find the 
first non-white node beginning with the node starting at index "start",
which may not be the first content node.

Which serialization tests are failing? The ones in jdom-test as of 4/16
all pass.

Brad

Philip Nelson writes:

> OK, since my cvs is still somewhat challenged, I'll just send the method. 
> Notice the change:  there is an early exit in the case where the content has
> data but the first node is not whitespace.  All my tests pass after this chan
> ge
> but there are not extensive tests of whitespace handling anywhere.
> 
> private int skipLeadingWhite( List content, int start) {
>         if (start <= 0) {
>             start = 0;
>         }
> 
>         int index = start;
>         int size = content.size();
>         
>         //check if the first node of the content list is not whitespace 
>         //and return the index 
>         if ( size > 0 && !isAllWhitespace( content.get(0))) 
>             return 0;
>         
>         if (currentFormat.trimAllWhite
>                 || currentFormat.textNormalize
>                 || currentFormat.textTrim
>                 || currentFormat.newlines) {
>             while( index < size) {
>                 if ( !isAllWhitespace( content.get(index))) {
>                     return index;
>                 }
>                 index++;
>             }
>         }
>         return size;
>     }
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
> _______________________________________________
> 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