xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ce...@apache.org
Subject cvs commit: xml-xmlbeans/v2/src/xmlstore/org/apache/xmlbeans/impl/store Cursor.java
Date Wed, 15 Oct 2003 18:13:28 GMT
cezar       2003/10/15 11:13:28

  Modified:    v2       build.xml
               v2/src/xmlstore/org/apache/xmlbeans/impl/store Cursor.java
  Log:
  First cut XPath implementation using Jaxen for the engine.
  
  Revision  Changes    Path
  1.6       +66 -1     xml-xmlbeans/v2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/build.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- build.xml	13 Oct 2003 23:23:56 -0000	1.5
  +++ build.xml	15 Oct 2003 18:13:28 -0000	1.6
  @@ -32,7 +32,7 @@
     <target name="jsr173.jar" depends="check.jsr173.jar, dirs" unless="jsr173.jar.exists">
       <get dest="build/lib/jsr173.jar"
            src="http://workshop.bea.com/xmlbeans/jsr173/jsr173.jar"
  -         verbose="true" usetimestamp="true" ignoreerrors="true"/> 
  +         verbose="true" usetimestamp="true" ignoreerrors="true"/>
     </target>
   
     <target name="check.jsr173_07_api.jar">
  @@ -49,6 +49,17 @@
       </unjar>
     </target>
   
  +  <target name="check.jaxen.jar">
  +    <condition property="jaxen.jar.exists">
  +        <available file="build/lib/jaxen.jar"/>
  +    </condition>
  +  </target>
  +
  +  <target name="jaxen.jar" depends="check.jaxen.jar, dirs" unless="jaxen.jar.exists">
  +    <get dest="build/lib/jaxen.jar"
  +         src="http://www.ibiblio.org/maven/jaxen/jars/jaxen-1.1-beta-2.jar"
  +         verbose="true" usetimestamp="true" ignoreerrors="true"/>
  +  </target>
   
     <target name="xbean" depends="xbean.jar">
       <copy file="build/lib/xbean.jar" tofile="build/ar/xbean.jar"/>
  @@ -881,4 +892,58 @@
           <javac srcdir="src/repackage" destdir="build/classes/repackage" source="1.4" debug="on"/>
       </target>
   
  +  <!-- xpath target ============================================= -->
  +
  +  <target name="xpath.classes" depends="dirs, xmlpublic.jar, jaxen.jar">
  +    <mkdir dir="build/private/classes/xpath"/>
  +    <javac
  +       srcdir="src/xpath"
  +       destdir="build/private/classes/xpath"
  +       classpathref="xpath.compile.path"
  +       source="1.4"
  +       debug="on">
  +      <classpath id="xpath.compile.path">
  +          <pathelement location="build/lib/xmlpublic.jar"/>
  +          <pathelement location="build/lib/jaxen.jar"/>
  +      </classpath>
  +    </javac>
  +  </target>
  +
  +  <target name="xbean_xpath.jar" depends="xpath.classes">
  +    <jar jarfile="build/private/lib/xbean_xpath.jar" basedir="build/private/classes/xpath"/>
  +  </target>
  +
  +  <!-- test xpath target ============================================= -->
  +
  +  <target name="test_xpath.classes" depends="dirs, xmlpublic.jar, jsr173_07_api.jar, jaxen.jar, xbean_xpath.jar">
  +    <mkdir dir="build/private/classes/testxpath"/>
  +    <javac
  +       srcdir="test/src/xpath"
  +       destdir="build/private/classes/testxpath"
  +       classpathref="testxpath.compile.path"
  +       source="1.4"
  +       debug="on">
  +      <classpath id="testxpath.compile.path">
  +          <pathelement location="build/lib/xmlpublic.jar"/>
  +          <pathelement location="build/lib/jsr173_07_api.jar"/>
  +          <pathelement location="build/lib/jaxen.jar"/>
  +          <pathelement location="build/private/lib/xbean_xpath.jar"/>
  +          <pathelement location="build/classes/xmlinputstream"/>
  +      </classpath>
  +    </javac>
  +  </target>
  +
  +  <target name="run_test_xpath" depends="test_xpath.classes, xbean">
  +    <java classname="org.apache.xmlbeans.impl.xpath.jaxen.XBeansDemo" fork="true" failonerror="true">
  +      <classpath>
  +          <pathelement location="build/lib/xbean.jar"/>
  +          <pathelement location="build/lib/jsr173_07_api.jar"/>
  +          <pathelement location="build/lib/jaxen.jar"/>
  +          <pathelement location="build/private/lib/xbean_xpath.jar"/>
  +          <pathelement location="build/private/classes/testxpath"/>
  +      </classpath>
  +      <jvmarg value="-ea"/>
  +      <arg line='test/cases/xpath/much_ado.xml "PLAY/ACT/SCENE/SPEECH/SPEAKER"'/>
  +    </java>
  +  </target>
   </project>
  
  
  
  1.4       +657 -657  xml-xmlbeans/v2/src/xmlstore/org/apache/xmlbeans/impl/store/Cursor.java
  
  Index: Cursor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlstore/org/apache/xmlbeans/impl/store/Cursor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Cursor.java	7 Oct 2003 04:08:03 -0000	1.3
  +++ Cursor.java	15 Oct 2003 18:13:28 -0000	1.4
  @@ -2,7 +2,7 @@
   * The Apache Software License, Version 1.1
   *
   *
  -* Copyright (c) 2003 The Apache Software Foundation.  All rights 
  +* Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
  -*    notice, this list of conditions and the following disclaimer. 
  +*    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
  @@ -18,19 +18,19 @@
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
  -*    if any, must include the following acknowledgment:  
  +*    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
  -* 4. The names "Apache" and "Apache Software Foundation" must 
  +* 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
  -*    software without prior written permission. For written 
  +*    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
  -* 5. Products derived from this software may not be called "Apache 
  -*    XMLBeans", nor may "Apache" appear in their name, without prior 
  +* 5. Products derived from this software may not be called "Apache
  +*    XMLBeans", nor may "Apache" appear in their name, without prior
   *    written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  @@ -49,7 +49,7 @@
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
  -* originally based on software copyright (c) 2000-2003 BEA Systems 
  +* originally based on software copyright (c) 2000-2003 BEA Systems
   * Inc., <http://www.bea.com/>. For more information on the Apache Software
   * Foundation, please see <http://www.apache.org/>.
   */
  @@ -109,7 +109,7 @@
       protected void finalize ( )
       {
           Splay s = getSplay();
  -        
  +
           if (s != null)
           {
               dispose();
  @@ -129,7 +129,7 @@
   
       Splay getSplay ( ) { return _goober.getSplay(); }
       int   getPos   ( ) { return _goober.getPos(); }
  -    
  +
       void set ( Splay s, int p ) { _goober.set( s, p ); }
       void set ( Splay s        ) { _goober.set( s, 0 ); }
       void set ( int p          ) { _goober.set( p ); }
  @@ -143,14 +143,14 @@
               return 0;
   
           Splay s = getSplay();
  -        
  +
           int pa = s.getPosAfter();
   
           assert p >= pa || s.isLeaf();
  -        
  +
           return p >= pa ? s.getCchAfter() - p + pa : s.getPosLeafEnd() - p;
       }
  -    
  +
       int getPreCch ( )
       {
           // TODO - quick and dirty impl, improve
  @@ -164,18 +164,18 @@
   
           return n;
       }
  -    
  +
       private void checkDisposed ( )
       {
           checkDisposed( this );
       }
  -    
  +
       private static void checkDisposed ( Cursor c )
       {
           if (c.isDisposed())
               throw new IllegalStateException( "Cursor has been disposed" );
       }
  -    
  +
       boolean isDisposed ( )
       {
           return getSplay() == null;
  @@ -192,10 +192,10 @@
               if (!isDisposed())
               {
                   clearSelections();
  -    
  +
                   if (_stack != null)
                       _stack.dispose();
  -    
  +
                   set( (Splay) null );
               }
           }
  @@ -206,27 +206,27 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               Root r = getRoot();
  -            
  +
               if (getPos() > 0)
                   return null;
  -    
  +
               Splay s = getSplay();
  -    
  +
               if (!s.isTypeable())
                   return null;
  -    
  +
               Type t = s.getType( r );
  -    
  +
               assert t != null;
  -    
  +
               XmlObject result = t.getXmlObject();
               assert result != null;
               return result;
           }
       }
  -    
  +
       public boolean toCursor ( XmlCursor moveTo )
       {
           if (moveTo == null)
  @@ -252,7 +252,7 @@
                       {
                           GlobalLock.release();
                           acquired = false;
  -                        
  +
                           return toCursorImpl( moveTo );
                       }
                   }
  @@ -268,23 +268,23 @@
               }
           }
       }
  -    
  +
       private boolean toCursorImpl ( XmlCursor moveTo )
       {
           checkDisposed();
  -        
  +
           Cursor c = null;
  -        
  +
           if (moveTo instanceof Cursor)
           {
               c = (Cursor) moveTo;
   
               checkDisposed( c );
  -            
  +
               if (c.getRoot() != getRoot())
                   c = null;
           }
  -        
  +
           if (c == null)
               return false;
   
  @@ -292,68 +292,68 @@
   
           return true;
       }
  -    
  +
       public XmlDocumentProperties documentProperties ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               return getRoot().documentProperties();
           }
       }
  -    
  +
       public XmlCursor newCursor ( )
  -    {
  +    {   
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               return new Cursor( getRoot(), getSplay(), getPos() );
           }
       }
  -    
  +
       public boolean toBookmark ( XmlBookmark bm )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               if (bm == null)
                   return false;
  -    
  +
               if (!(bm._currentMark instanceof Annotation))
                   return false;
  -    
  +
               Annotation a = (Annotation) bm._currentMark;
  -    
  +
               if (a.getRoot() != getRoot())
                   return false;
  -    
  +
               assert a.getSplay() != null;
  -    
  +
               set( a );
  -    
  +
               return true;
           }
       }
  -    
  +
       public XmlBookmark toNextBookmark ( Object key )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (key == null)
                   return null;
  -    
  +
               Splay sOrig = getSplay();
               int   pOrig = getPos();
  -    
  +
               TokenType tt = currentTokenType();
  -    
  +
               // Advance the cursor past the current spot by the minimun amount
  -    
  +
               if (tt.isText())
               {
                   toNextChar( 1 );
  @@ -364,28 +364,28 @@
                   set( sOrig, pOrig );
                   return null;
               }
  -    
  +
               for ( ; ; )
               {
                   XmlBookmark bm = getBookmark( key );
  -    
  +
                   if (bm != null)
                       return bm;
  -    
  +
                   int postCch;
  -    
  +
                   if (tt.isText() && (postCch = getPostCch()) > 1)
                   {
                       Splay s = getSplay();
                       int   p = getPos();
                       int   d = postCch;
  -    
  +
                       for ( Goober g = s.firstGoober() ; g != null ;
                             g = s.nextGoober( g ) )
                       {
                           int dist;
                           XmlBookmark mark;
  -    
  +
                           if (g.isAnnotation() && (dist = g.getPos() - p) > 1 &&
                                   dist < d && (mark = g.getBookmark()) != null &&
                                       mark.getKey().equals( key ))
  @@ -394,14 +394,14 @@
                               d = dist;
                           }
                       }
  -    
  +
                       if (bm != null)
                       {
                           set( s, p + d );
                           return bm;
                       }
                   }
  -                
  +
                   if ((tt = toNextToken()).isNone())
                   {
                       set( sOrig, pOrig );
  @@ -416,17 +416,17 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (key == null)
                   return null;
  -    
  +
               Splay sOrig = getSplay();
               int   pOrig = getPos();
  -    
  +
               TokenType tt = prevTokenType();
  -    
  +
               // Retreat the cursor past the current spot by the minimun amount
  -    
  +
               if (tt.isText())
               {
                   toPrevChar( 1 );
  @@ -439,21 +439,21 @@
               }
               else
                   tt = prevTokenType();
  -    
  +
               for ( ; ; )
               {
                   XmlBookmark bm = getBookmark( key );
  -    
  +
                   if (bm != null)
                       return bm;
  -    
  +
                   int preCch;
  -    
  +
                   if (tt.isText() && (preCch = getPreCch()) > 1)
                   {
                       Splay s;
                       int   p;
  -    
  +
                       if (getPos() == 0)
                       {
                           s = getSplay().prevNonAttrSplay();
  @@ -464,15 +464,15 @@
                           s = getSplay();
                           p = getPos();
                       }
  -                    
  +
                       int d = preCch;
  -    
  +
                       for ( Goober g = s.firstGoober() ; g != null ;
                             g = s.nextGoober( g ) )
                       {
                           int dist;
                           XmlBookmark mark;
  -    
  +
                           if (g.isAnnotation() && (dist = p - g.getPos()) > 1 &&
                                   dist < d && (mark = g.getBookmark()) != null &&
                                       mark.getKey().equals( key ))
  @@ -481,14 +481,14 @@
                               d = dist;
                           }
                       }
  -    
  +
                       if (bm != null)
                       {
                           set( s, p - d );
                           return bm;
                       }
                   }
  -    
  +
                   if (tt.isText())
                   {
                       toPrevChar( -1 );
  @@ -504,17 +504,17 @@
               }
           }
       }
  -    
  +
       public TokenType currentTokenType ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               return getSplay().getTokenType( getPos() );
           }
       }
  -    
  +
       public boolean isStartdoc  ( ) { return currentTokenType().isStartdoc(); }
       public boolean isEnddoc    ( ) { return currentTokenType().isEnddoc(); }
       public boolean isStart     ( ) { return currentTokenType().isStart(); }
  @@ -527,69 +527,69 @@
       public boolean isContainer ( ) { return currentTokenType().isContainer(); }
       public boolean isFinish    ( ) { return currentTokenType().isFinish(); }
       public boolean isAnyAttr   ( ) { return currentTokenType().isAnyAttr(); }
  -    
  +
       public TokenType prevTokenType ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               // TODO - quick and dirty implementation, improve
  -    
  +
               Splay sOrig = getSplay();
               int   pOrig = getPos();
  -    
  +
               TokenType tt;
  -    
  +
               if (toPrevChar( 1 ) == 1)
                   tt = TokenType.TEXT;
               else if (!(tt = toPrevToken()).isNone())
                   tt = currentTokenType();
  -    
  +
               set( sOrig, pOrig );
  -    
  +
               return tt;
           }
       }
  -    
  +
       public TokenType toNextToken ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               Splay os = getSplay(); // Orignal splay
               Splay s = os;
               int   p = getPos();
  -    
  +
               if (p == 0)
               {
                   if (s.isRoot())
                       return TokenType.NONE;
  -    
  +
                   //
                   // Look see if there is an attr we should visit before visiting
                   // any following content in this container.
                   //
  -                
  +
                   if (s.isContainer())
                   {
                       Splay t = s.nextSplay();
  -    
  +
                       if (t.isAttr())
                       {
                           set( t, 0 );
                           return currentTokenType();
                       }
  -                        
  +
                       //
                       // Now we're going into the content of this container.  Flush
                       // out any cached type value.
                       //
  -    
  +
                       s.ensureContentValid();
                   }
  -    
  +
                   if (s.getMaxPos() > 0)
                       p = 1;
                   else
  @@ -602,7 +602,7 @@
               {
                   assert p > 0;
                   assert !s.isRoot();
  -                
  +
                   if (p >= s.getPosAfter() && s.getCchAfter() > 0)
                   {
                       s = s.nextSplay();
  @@ -612,7 +612,7 @@
                   {
                       assert s.isLeaf();
                       assert p < s.getPosAfter();
  -    
  +
                       if (p != s.getPosLeafEnd())
                           p = s.getPosLeafEnd();
                       else if (s.getCchAfter() > 0)
  @@ -624,7 +624,7 @@
                       }
                   }
               }
  -    
  +
               //
               // If we are transitioning from an attr to a non attr, see if there
               // is content in a DOC or BEGIN which needs to be visited after
  @@ -638,22 +638,22 @@
               // container, we need to visit any attributes before visiting the
               // interior content of the attr container.
               //
  -    
  +
               if (p == 0)
               {
                   if (!s.isAttr() && os.isAttr())
                   {
                       Splay t = os.prevNonAttrSplay();
  -    
  +
                       assert t.isContainer();
  -    
  +
                       //
                       // We're navigating to the content of a container.  Flush
                       // out any cached type value.
                       //
  -                    
  +
                       t.ensureContentValid();
  -    
  +
                       if (t.getMaxPos() > 0)
                       {
                           s = t;
  @@ -663,13 +663,13 @@
                   else if (s.isAttr() && !os.isAttr() && os.getMaxPos() > 0)
                   {
                       assert os.isContainer();
  -    
  +
                       s = s.nextNonAttrSplay();
                   }
               }
  -    
  +
               set( s, p );
  -    
  +
               return currentTokenType();
           }
       }
  @@ -679,97 +679,97 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
       // TODO - This code is not as compact as it can be, there is some redundancy
       // -- rethink it later ...
  -    
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               if (p == 1 && s.isInvalid())
               {
                   assert s.isLeaf();
                   p += s.ensureContentValid();
               }
  -    
  +
               if (p == 1 && s.isContainer())
               {
                   Splay t = s.nextSplay();
  -    
  +
                   if (t.isAttr())
                   {
                       s = t;
  -                    
  +
                       for ( t = t.nextSplay() ; t.isAttr() ; t = t.nextSplay() )
                           s = t;
  -    
  +
                       set( s, 0 );
  -                    
  +
                       return currentTokenType();
                   }
               }
  -    
  +
               if (p == 0 && !s.isAttr())
               {
                   if (s.isDoc())
                       return TokenType.NONE;
  -    
  +
                   Splay t = s.prevSplay();
  -    
  +
                   if (t.isAttr())
                   {
                       t = t.prevNonAttrSplay();
  -    
  +
                       assert t.isContainer();
  -    
  +
                       if (t.isDoc())
                           t.ensureContentValid();
  -    
  +
                       if (t.getMaxPos() > 0)
                       {
                           set(
                               t,
                               t.getCchAfter() > 0 ? t.getPosAfter() : t.getMaxPos() );
  -    
  +
                           return currentTokenType();
                       }
                   }
               }
  -    
  +
               if (s.isAttr())
               {
                   assert p == 0;
  -    
  +
                   Splay t = s.prevSplay();
  -    
  +
                   if (!t.isAttr())
                   {
                       assert t.isContainer();
  -    
  +
                       set( t, 0 );
                       return currentTokenType();
                   }
               }
  -    
  +
               if (p == 0)
               {
                   if (s.isDoc())
                       return TokenType.NONE;
  -    
  +
                   s = s.prevSplay();
  -    
  +
                   if (s.isDoc())
                       s.ensureContentValid();
  -    
  +
                   p = s.getCchAfter() > 0 ? s.getPosAfter() : s.getMaxPos();
               }
               else
               {
                   assert p > 0;
                   assert !s.isRoot();
  -    
  +
                   int posAfter = s.getPosAfter();
  -    
  +
                   if (p >= posAfter)
                   {
                       assert s.getCchAfter() > 0;
  @@ -779,13 +779,13 @@
                   {
                       assert s.isValid();
                       assert s.isLeaf();
  -                    
  +
                       p = p > 1 && p == posAfter - 1 ? 1 : 0;
                   }
               }
  -    
  +
               set( s, p );
  -    
  +
               return currentTokenType();
           }
       }
  @@ -795,24 +795,24 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               Splay s = getSplay();
               int   p = getPos();
  -            
  +
               if (p == 0)
               {
                   if (s.isDoc() || s.isAttr())
                       throw new IllegalStateException( "Invalid location for text" );
  -    
  +
                   s = s.prevNonAttrSplay();
                   p = s.getEndPos();
               }
  -    
  +
               if (text == null)
                   return;
  -    
  +
               int cch = text.length();
  -    
  +
               if (cch > 0)
                   s.insertChars( p, getRoot(), text, 0, cch );
           }
  @@ -822,7 +822,7 @@
       {
           if (name == null)
               throw new IllegalArgumentException( "QName is null" );
  -        
  +
           validateLocalName( name.getLocalPart() );
       }
   
  @@ -858,7 +858,7 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               insert( new Attr( name ), value );
           }
       }
  @@ -908,17 +908,17 @@
                   prefix = "";
               else if (prefix.length() > 0)
                   validatePrefix( prefix );
  -    
  +
               if (namespace == null)
                   namespace = "";
  -    
  +
               if (namespace.length() == 0 && prefix.length() > 0)
               {
                   throw
                       new IllegalArgumentException(
                           "Can't map a prefix to no namespace" );
               }
  -    
  +
               insert( new Xmlns( new QName( namespace, prefix ) ), null );
           }
       }
  @@ -928,7 +928,7 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               insert( new Comment(), value );
           }
       }
  @@ -936,11 +936,11 @@
       public void insertProcInst ( String target, String value )
       {
           validatePrefix( target ); // used becuase "<?xml...?> is disallowed
  -    
  +
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               insert( new Procinst( target ), value );
           }
       }
  @@ -959,24 +959,24 @@
       {
           insertElementWithText( name, uri, null );
       }
  -    
  +
       public void insertElement ( QName name )
       {
           insertElementWithText( name, null );
       }
  -    
  +
       public void beginElement ( QName name )
       {
           insertElement( name );
           toPrevToken();
       }
  -    
  +
       public void beginElement ( String name )
       {
           insertElement( name );
           toPrevToken();
       }
  -    
  +
       public void beginElement ( String name, String uri )
       {
           insertElement( name, uri );
  @@ -988,17 +988,17 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               validateLocalName( name.getLocalPart() );
  -    
  +
               Begin b = new Begin( name, null );
  -            
  +
               b.toggleIsLeaf();
  -            
  +
               insert( b, text );
           }
       }
  -    
  +
       public void insertElementWithText ( String name, String uri, String text )
       {
           insertElementWithText( new QName( uri, name ), text );
  @@ -1031,15 +1031,15 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
  -    
  +
               if (getPos() > 0 || s.isFinish() || s.isXmlns())
               {
                   throw new IllegalStateException(
                       "Can't get text value, current token can have no text value" );
               }
  -    
  +
               return getSplay().getText( getRoot() );
           }
       }
  @@ -1049,20 +1049,20 @@
   //        synchronized ( monitor() )
   //        {
   //            checkDisposed();
  -//    
  +//
   //            Splay s = getSplay();
  -//    
  +//
   //            if (getPos() > 0 || s.isFinish() || s.isXmlns())
   //            {
   //                throw new IllegalStateException(
   //                    "Can't get text value, current token can have no text value" );
   //            }
  -//    
  +//
   //            return getSplay().getText( getRoot() );
   //        }
   
           // Hack impl for now
  -        
  +
           String s = getTextValue();
   
           int n = s.length();
  @@ -1077,23 +1077,23 @@
   
           return n;
       }
  -    
  +
       public void setTextValue ( String text )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               if (p > 0 || s.isXmlns() || s.isFinish())
               {
                   throw new IllegalStateException(
                       "Can't set text value, current token can have no text value" );
               }
  -    
  -    
  +
  +
               s.setText( getRoot(), text, 0, text == null ? 0 : text.length() );
           }
       }
  @@ -1102,20 +1102,20 @@
       {
           setTextValue( String.copyValueOf( buf, off, len ) );
       }
  -    
  +
       public String getChars ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               int cch = -1;
  -    
  +
               int postCch = getPostCch();
  -    
  +
               if (cch < 0 || cch > postCch)
                   cch = postCch;
  -    
  +
               return
                   getRoot()._text.fetch(
                       getSplay().getCpForPos( getRoot(), getPos() ), cch );
  @@ -1127,21 +1127,21 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               int postCch = getPostCch();
  -    
  +
               if (cch < 0 || cch > postCch)
                   cch = postCch;
  -    
  +
               if (buf == null || off >= buf.length)
                   return 0;
  -    
  +
               if (buf.length - off < cch)
                   cch = buf.length - off;
  -    
  +
               getRoot()._text.fetch(
                   buf, off, getSplay().getCpForPos( getRoot(), getPos() ), cch );
  -    
  +
               return cch;
           }
       }
  @@ -1151,17 +1151,17 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (annotation == null)
                   return;
  -    
  +
               clearBookmark( annotation.getKey() );
  -    
  +
               Annotation a = new Annotation( getRoot(), annotation );
  -    
  +
               if (a._key == null)
                   throw new IllegalArgumentException( "Annotation key is null" );
  -    
  +
               a.set( _goober );
               annotation._currentMark = a;
           }
  @@ -1172,26 +1172,26 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (key == null)
                   return null;
  -    
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               for ( Goober g = s.firstGoober() ; g != null ; g = s.nextGoober( g ) )
               {
                   if (g.getKind() == Splay.ANNOTATION && g.getPos() == p)
                   {
                       Annotation a = (Annotation) g;
  -    
  +
                       XmlBookmark xa = a.getXmlBookmark();
  -    
  +
                       if (xa != null && a._key.equals( key ))
                           return xa;
                   }
               }
  -    
  +
               return null;
           }
       }
  @@ -1201,21 +1201,21 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (key == null)
                   return;
  -    
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               for ( Goober g = s.firstGoober() ; g != null ; g = s.nextGoober( g ) )
               {
                   if (g.getKind() == Splay.ANNOTATION && g.getPos() == p)
                   {
                       Annotation a = (Annotation) g;
  -    
  +
                       XmlBookmark xa = a.getXmlBookmark();
  -    
  +
                       if (xa != null && a._key.equals( key ))
                       {
                           g.set( null, 0 );
  @@ -1231,13 +1231,13 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (listToFill == null)
                   return;
  -    
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               for ( Goober g = s.firstGoober() ; g != null ; g = s.nextGoober( g ) )
               {
                   if (g.getKind() == Splay.ANNOTATION && g.getPos() == p)
  @@ -1251,7 +1251,7 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               assert !getSplay().isRoot() || getPos() == 0;
               return !getSplay().isRoot();
           }
  @@ -1272,12 +1272,12 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (getPos() > 0)
                   return null;
  -    
  +
               Splay s = getSplay();
  -    
  +
               switch ( s.getKind() )
               {
               case Splay.BEGIN :
  @@ -1285,7 +1285,7 @@
               case Splay.PROCINST :
                   return s.getName();
               }
  -    
  +
               return null;
           }
       }
  @@ -1295,23 +1295,23 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (name == null)
                   throw new IllegalArgumentException( "Name is null" );
  -            
  +
               Splay s = getSplay();
  -            
  +
               if (getPos() > 0 || !(s.isBegin() || s.isAttr() || s.isProcinst()))
               {
                   throw
                       new IllegalStateException(
                           "Can't set name here: " + currentTokenType() );
               }
  -    
  +
               if (s.isProcinst())
               {
                   validatePrefix( name.getLocalPart() );
  -    
  +
                   if (name.getNamespaceURI().length() > 0)
                   {
                       throw
  @@ -1326,35 +1326,35 @@
               }
               else
                   validateLocalName( name.getLocalPart() );
  -    
  +
               s.setName( getRoot(), name );
           }
       }
  -    
  +
       public int toNextChar ( int cch )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               int maxCch = getPostCch();
  -    
  +
               if (maxCch == 0 || cch == 0)
                   return 0;
  -    
  +
               if (cch < 0 || cch > maxCch)
                   cch = maxCch;
  -    
  +
               assert p + cch <= s.getEndPos();
  -    
  +
               if (p + cch == s.getEndPos())
                   toNextToken();
               else
                   set( p + cch );
  -    
  +
               return cch;
           }
       }
  @@ -1364,14 +1364,14 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               Splay sText = s;  // The splay and pos where the text exists
               int   pText = p;
               int   maxCch = 0; // Max chars to move over
  -    
  +
               if (p == 0)
               {
                   if (!s.isDoc() && !s.isAttr())
  @@ -1390,17 +1390,17 @@
               }
               else
                   maxCch = p - s.getPosAfter();
  -    
  +
               assert pText <= sText.getEndPos();
  -    
  +
               if (maxCch == 0 || cch == 0)
                   return 0;
  -    
  +
               if (cch < 0 || cch > maxCch)
                   cch = maxCch;
  -    
  +
               set( sText, pText - cch );
  -    
  +
               return cch;
           }
       }
  @@ -1410,7 +1410,7 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               set( getRoot(), 0 );
           }
       }
  @@ -1420,7 +1420,7 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               set( getRoot()._doc, 0 );
           }
       }
  @@ -1430,19 +1430,19 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
  -    
  +
               if (getPos() > 0 || !s.isContainer())
                   return TokenType.NONE;
  -    
  +
               s.ensureContentValid();
  -    
  +
               if (s.getCch() > 0 || s.isLeaf())
                   set( 1 );
               else
                   set( s.nextNonAttrSplay(), 0 );
  -    
  +
               return currentTokenType();
           }
       }
  @@ -1452,17 +1452,17 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
  -    
  +
               if (getPos() > 0 || !s.isContainer())
                   return TokenType.NONE;
  -    
  +
               if (s.isLeaf())
                   set( s.getPosLeafEnd() );
               else
                   set( s.getFinishSplay() );
  -    
  +
               return currentTokenType();
           }
       }
  @@ -1472,15 +1472,15 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               if (p == 0 && s.isDoc())
                   return false;
  -    
  +
               set( s.getContainer( p ), 0 );
  -    
  +
               return true;
           }
       }
  @@ -1490,15 +1490,15 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               if (p == 0)
               {
                   if (s.isDoc())
                       return false;
  -    
  +
                   if (s.isBegin())
                       s = s.getFinishSplay().nextSplay();
               }
  @@ -1506,18 +1506,18 @@
               {
                   if (s.isLeaf() && p <= s.getPosLeafEnd())
                       return false;
  -    
  +
                   s = s.nextSplay();
               }
  -    
  +
               for ( ; !s.isBegin() ; s = s.nextSplay() )
               {
                   if (s.isFinish())
                       return false;
               }
  -    
  +
               set( s, 0 );
  -    
  +
               return true;
           }
       }
  @@ -1537,61 +1537,61 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               Splay sOriginal = getSplay();
               int   pOriginal = getPos();
  -            
  +
               for ( ; ; )
               {
                   if (!toNextSibling())
                       break;
  -    
  +
                   if (getName().equals( name ))
                       return true;
               }
  -            
  +
               set( sOriginal, pOriginal );
  -            
  +
               return false;
           }
       }
  -    
  +
       public boolean toPrevSibling ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               if (p == 0)
               {
                   if (s.isDoc() || s.isAttr())
                       return false;
  -    
  +
                   s = s.prevSplay();
               }
               else
               {
                   assert p > 0;
  -    
  +
                   if (s.isContainer())
                   {
                       if (s.isLeaf())
                       {
                           if (p <= s.getPosLeafEnd())
                               return false;
  -    
  +
                           set( 0 );
  -    
  +
                           return true;
                       }
  -    
  +
                       return false;
                   }
               }
  -    
  +
               for ( ; ; )
               {
                   if (s.isEnd())
  @@ -1599,18 +1599,18 @@
                       s = s.getContainer();
                       break;
                   }
  -    
  +
                   if (s.isLeaf())
                       break;
  -    
  +
                   if (s.isContainer())
                       return false;
  -    
  +
                   s = s.prevSplay();
               }
  -    
  +
               set( s, 0 );
  -    
  +
               return true;
           }
       }
  @@ -1656,14 +1656,14 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getRoot().findNthBegin( getStart(), name, null, 0 );
  -    
  +
               if (s == null)
                   return false;
  -    
  +
               set( s, 0 );
  -    
  +
               return true;
           }
       }
  @@ -1678,14 +1678,14 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getRoot().findNthBegin( getStart(), name, null, n );
  -    
  +
               if (s == null)
                   return false;
  -    
  +
               set( s, 0 );
  -    
  +
               return true;
           }
       }
  @@ -1695,21 +1695,21 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay sOriginal = getSplay();
               int   pOriginal = getPos();
  -            
  +
               if (!sOriginal.isContainer() || pOriginal != 0)
               {
                   if (!toNextSibling())
                       return false;
               }
  -    
  +
               if (!toEndToken().isNone() && toPrevSibling())
                   return true;
  -    
  +
               set( sOriginal, pOriginal );
  -            
  +
               return false;
           }
       }
  @@ -1719,13 +1719,13 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay sOriginal = getSplay();
               int   pOriginal = getPos();
  -            
  +
               if (!sOriginal.isContainer() || pOriginal != 0)
                   return false;
  -    
  +
               for ( Splay s = sOriginal.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
               {
                   if (s.isNormalAttr())
  @@ -1734,7 +1734,7 @@
                       return true;
                   }
               }
  -    
  +
               set( sOriginal, pOriginal );
               return false;
           }
  @@ -1745,27 +1745,27 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay sOriginal = getSplay();
               int   pOriginal = getPos();
  -            
  +
               if (!sOriginal.isContainer() || pOriginal != 0)
                   return false;
  -    
  +
               Splay lastNormalAttr = null;
  -    
  +
               for ( Splay s = sOriginal.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
               {
                   if (s.isNormalAttr())
                       lastNormalAttr = s;
               }
  -    
  +
               if (lastNormalAttr != null)
               {
                   set( lastNormalAttr, 0 );
                   return true;
               }
  -    
  +
               set( sOriginal, pOriginal );
               return false;
           }
  @@ -1776,12 +1776,12 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
  -    
  +
               if (!s.isAttr())
                   return false;
  -    
  +
               for ( s = s.nextSplay() ; s.isAttr() ; s = s.nextSplay() )
               {
                   if (s.isNormalAttr())
  @@ -1790,7 +1790,7 @@
                       return true;
                   }
               }
  -    
  +
               return false;
           }
       }
  @@ -1800,12 +1800,12 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
  -    
  +
               if (!s.isAttr())
                   return false;
  -    
  +
               for ( s = s.prevSplay() ; s.isAttr() ; s = s.prevSplay() )
               {
                   if (s.isNormalAttr())
  @@ -1814,7 +1814,7 @@
                       return true;
                   }
               }
  -    
  +
               return false;
           }
       }
  @@ -1824,15 +1824,15 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (attrName == null)
                   throw new IllegalArgumentException( "Attr name is null" );
  -    
  +
               if (getPos() > 0)
                   return null;
  -    
  +
               Splay s = getSplay().getAttr( attrName );
  -    
  +
               return s == null ? null : s.getText( getRoot() );
           }
       }
  @@ -1842,37 +1842,37 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (attrName == null)
                   throw new IllegalArgumentException( "Attr name is null" );
  -    
  +
               validateLocalName( attrName.getLocalPart() );
  -            
  +
               if (getPos() > 0)
                   return false;
  -    
  +
               Splay s = getSplay();
  -    
  +
               if (!s.isContainer())
                   return false;
  -    
  +
               if (value == null)
                   value = "";
  -    
  +
               s = getSplay().getAttr( attrName );
  -    
  +
               if (s == null)
               {
                   XmlCursor c = newCursor();
  -    
  +
                   try
                   {
                       // Insert the new attr at the end
  -                    
  +
                       do {
                           c.toNextToken();
                       } while ( c.isAnyAttr() );
  -                    
  +
                       c.insertAttributeWithValue( attrName, value );
                   }
                   finally
  @@ -1882,7 +1882,7 @@
               }
               else
                   s.setText( getRoot(), value, 0, value.length() );
  -    
  +
               return true;
           }
       }
  @@ -1892,27 +1892,27 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (attrName == null)
                   throw new IllegalArgumentException( "Attr name is null" );
  -    
  +
               if (getPos() > 0)
                   return false;
  -    
  +
               boolean removed = false;
  -            
  +
               for ( ; ; )
               {
                   Splay s = getSplay().getAttr( attrName );
  -    
  +
                   if (s == null)
                       break;
  -                
  +
                   s.remove( getRoot(), true );
  -    
  +
                   removed = true;
               }
  -    
  +
               return removed;
           }
       }
  @@ -1922,24 +1922,24 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               int postCch = getPostCch();
  -    
  +
               if (postCch == 0 || cch == 0)
                   return 0;
  -    
  +
               if (cch < 0 || cch > postCch)
                   cch = postCch;
  -    
  +
               return getSplay().removeChars( getRoot(), getPos(), cch );
           }
       }
  -    
  +
       public int moveChars ( int cch, XmlCursor dst )
       {
           if (dst == null)
               throw new IllegalArgumentException( "Destination is null" );
  -            
  +
           if (monitor() == dst.monitor())
           {
               synchronized ( monitor() )
  @@ -1960,7 +1960,7 @@
                       {
                           GlobalLock.release();
                           acquired = false;
  -                        
  +
                           return moveCharsImpl( cch, dst );
                       }
                   }
  @@ -1976,7 +1976,7 @@
               }
           }
       }
  -    
  +
       private int moveCharsImpl ( int cch, XmlCursor dst )
       {
           checkDisposed();
  @@ -2004,7 +2004,7 @@
       {
           if (dst == null)
               throw new IllegalArgumentException( "Destination is null" );
  -        
  +
           if (dst.monitor() == monitor())
           {
               synchronized ( monitor() )
  @@ -2025,7 +2025,7 @@
                       {
                           GlobalLock.release();
                           acquired = false;
  -                        
  +
                           return copyCharsImpl( cch, dst );
                       }
                   }
  @@ -2041,7 +2041,7 @@
               }
           }
       }
  -    
  +
       private int copyCharsImpl ( int cch, XmlCursor dst )
       {
           checkDisposed();
  @@ -2061,7 +2061,7 @@
           {
               if (sDst.isDoc() || sDst.isAttr())
                   throw new IllegalArgumentException( "Invalid destination" );
  -            
  +
               sDst = sDst.prevNonAttrSplay();
               pDst = sDst.getEndPos();
           }
  @@ -2075,12 +2075,12 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
  -    
  +
               if (getPos() > 0 || !s.isContainer())
                   throw new IllegalStateException( "Not on a container" );
  -    
  +
               return s.namespaceForPrefix( prefix );
           }
       }
  @@ -2090,15 +2090,15 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (ns == null || ns.length() == 0)
                   throw new IllegalArgumentException( "Must specify a namespace" );
  -    
  +
               Splay s = getSplay();
  -    
  +
               if (getPos() > 0 || !s.isContainer())
                   throw new IllegalStateException( "Not on a container" );
  -    
  +
               String result = s.prefixForNamespace( getRoot(), ns, null, true);
   
               assert result != null;
  @@ -2112,54 +2112,54 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               Splay s = getSplay();
  -    
  +
               if (getPos() > 0 || !s.isContainer())
                   throw new IllegalStateException( "Not on a container" );
  -    
  +
               // Do this with cursor for now...
  -            
  +
               XmlCursor c = newCursor();
  -    
  +
               do
               {
                   assert c.isContainer();
  -    
  +
                   QName cName = c.getName();
  -                
  +
                   while ( !c.toNextToken().isNone() && c.isAnyAttr() )
                   {
                       if (c.isNamespace())
                       {
                           String prefix = c.getName().getLocalPart();
                           String uri    = c.getName().getNamespaceURI();
  -    
  +
                           // Here I check to see if there is a default namespace
                           // mapping which is not empty on a non root container which
                           // is in a namespace.  This this case, I do not want to add
                           // this mapping because it could not be persisted out this
                           // way.
  -                        
  +
                           if (prefix.length() == 0 && uri.length() > 0 &&
                                   cName != null && cName.getNamespaceURI().length()>0)
                           {
                               continue;
                           }
  -    
  +
                           if (!addToThis.containsKey( prefix ))
                               addToThis.put( prefix, uri );
                       }
                   }
  -    
  +
                   c.toParent();
               }
               while ( c.toParent() );
  -    
  +
               c.dispose();
           }
       }
  -    
  +
       /**
        * Returns:
        *
  @@ -2173,34 +2173,34 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               if (xthat == null || !(xthat instanceof Cursor))
                   throw new IllegalArgumentException( "Invalid that cursor" );
  -    
  +
               Cursor that = (Cursor) xthat;
  -            
  +
               Root r = getRoot();
  -    
  +
               if (r != that.getRoot())
                   throw new IllegalArgumentException( "Cursors not in same document" );
  -    
  +
               checkDisposed( that );
  -    
  +
               return
                   getSplay().compare( r, getPos(), that.getSplay(), that.getPos() );
           }
       }
  -    
  +
       public boolean isLeftOf ( XmlCursor that )
       {
           return comparePosition( that ) < 0;
       }
  -    
  +
       public boolean isAtSamePositionAs ( XmlCursor that )
       {
           return comparePosition( that ) == 0;
       }
  -    
  +
       public boolean isRightOf ( XmlCursor that )
       {
           return comparePosition( that ) > 0;
  @@ -2211,13 +2211,13 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               return
                   new Saver.InputStreamSaver(
                       getRoot(), getSplay(), getPos(), options );
           }
       }
  -    
  +
       public InputStream newInputStream ( )
       {
           return newInputStream( null );
  @@ -2227,38 +2227,38 @@
       {
           return newReader( null );
       }
  -    
  +
       public Reader newReader ( XmlOptions options )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               return new Saver.TextReader( getRoot(), getSplay(), getPos(), options );
           }
       }
  -    
  +
       public XMLInputStream newXMLInputStream ( )
       {
           return newXMLInputStream( null );
       }
  -    
  +
       public XMLInputStream newXMLInputStream ( XmlOptions options )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               return
                   new XmlInputStreamImpl( getRoot(), getSplay(), getPos(), options );
           }
       }
  -    
  +
       public XMLStreamReader newXMLStreamReader ( )
       {
           return newXMLStreamReader( null );
       }
  -    
  +
       public XMLStreamReader newXMLStreamReader ( XmlOptions options )
       {
           synchronized ( monitor() )
  @@ -2271,7 +2271,7 @@
               {
                   if (isNamespace())
                       return new XMLStreamReaderForString( newCursor(), getName().getNamespaceURI() );
  -                
  +
                   if (isAttr() || isComment() || isProcinst())
                       return new XMLStreamReaderForString( newCursor(), getTextValue() );
               }
  @@ -2281,13 +2281,13 @@
   
               if (isFinish())
                   return new XMLStreamReaderForString( newCursor(), "" );
  -            
  +
               assert !isText() && !isFinish();
               assert !inner || isContainer();
  -            
  +
               XmlCursor start = newCursor();
               XmlCursor last = newCursor();
  -            
  +
               if (inner)
               {
                   start.toNextToken();
  @@ -2303,11 +2303,11 @@
                   if (isContainer())
                       last.toEndToken();
               }
  -            
  +
               return new XMLStreamReaderImpl( start, last );
           }
       }
  -            
  +
       private static final XmlOptions _toStringOptions =
           buildPrettyOptions();
   
  @@ -2324,19 +2324,19 @@
       {
           return xmlText( _toStringOptions );
       }
  -    
  +
       public String xmlText (  )
       {
           return xmlText( null );
       }
  -    
  +
       public String xmlText ( XmlOptions options )
       {
           Saver.TextSaver saver;
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               saver = new Saver.TextSaver(
                       getRoot(), getSplay(), getPos(), options, null );
           }
  @@ -2359,37 +2359,37 @@
           private final Root _root;
           private final long _versionStamp;
       }
  -    
  +
       public ChangeStamp getDocChangeStamp ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -        
  +
               return new ChangeStampImpl( getRoot() );
           }
       }
  -    
  +
       public boolean removeXml ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               Splay s = getSplay();
               int   p = getPos();
  -    
  +
               assert p < s.getEndPos();
  -    
  +
               if (p > 0)
               {
                   if (s.isLeaf() && p == s.getPosLeafEnd())
                       return false;
  -    
  +
                   int cchRemove = removeChars( getPostCch() );
  -    
  +
                   assert cchRemove > 0;
  -    
  +
                   return true;
               }
               else if (s.isDoc())
  @@ -2400,18 +2400,18 @@
               }
               else if (s.isFinish())
                   return false;
  -    
  +
               s.remove( getRoot(), true );
  -    
  +
               return true;
           }
       }
  -    
  +
       public boolean moveXml ( XmlCursor dst )
       {
           if (dst == null)
               throw new IllegalArgumentException( "Destination is null" );
  -        
  +
           if (dst.monitor() == monitor())
           {
               synchronized ( monitor() )
  @@ -2432,7 +2432,7 @@
                       {
                           GlobalLock.release();
                           acquired = false;
  -                        
  +
                           return moveXmlImpl ( dst );
                       }
                   }
  @@ -2448,60 +2448,60 @@
               }
           }
       }
  -    
  +
       private boolean moveXmlImpl  ( XmlCursor dst )
       {
           checkDisposed();
  -                    
  +
           if (dst == null || !(dst instanceof Cursor))
           {
               throw
                   new IllegalArgumentException(
                       "Can't move to a foreign document" );
           }
  -            
  +
           Cursor cDst = (Cursor) dst;
  -                    
  +
           checkDisposed( cDst );
  -                    
  +
           Root  rDst = cDst.getRoot();
           Splay sDst = cDst.getSplay();
           int   pDst = cDst.getPos();
  -            
  +
           Root  rSrc = getRoot();
           Splay sSrc = getSplay();
           int   pSrc = getPos();
  -            
  +
           if (sSrc.checkInsertionValidity( pSrc, sDst, pDst, true ))
           {
               return
                   sSrc.moveChars(
                       rSrc, pSrc, getPostCch(), rDst, sDst, pDst, false ) > 0;
           }
  -                    
  +
           assert pSrc == 0;
  -            
  +
           // Check for a movement of stuff into itself!  This case is basically
           // a no-op
  -            
  +
           if (rSrc == rDst && sDst.between( rDst, pDst, sSrc ))
           {
   // TODO - I might have to orphan types in the range here ....
               return false;
           }
  -            
  +
           assert pSrc == 0;
  -            
  +
           sSrc.move( rSrc, cDst.getRoot(), cDst.getSplay(), cDst.getPos(), true );
  -            
  +
           return true;
       }
  -    
  +
       public boolean copyXml ( XmlCursor dst )
       {
           if (dst == null)
               throw new IllegalArgumentException( "Destination is null" );
  -        
  +
           if (dst.monitor() == monitor())
           {
               synchronized ( monitor() )
  @@ -2522,7 +2522,7 @@
                       {
                           GlobalLock.release();
                           acquired = false;
  -                        
  +
                           return copyXmlImpl( dst );
                       }
                   }
  @@ -2538,38 +2538,38 @@
               }
           }
       }
  -    
  +
       private boolean copyXmlImpl ( XmlCursor dst )
       {
           checkDisposed();
  -                    
  +
           if (dst == null || !(dst instanceof Cursor))
           {
               throw
                   new IllegalArgumentException( "Can't copy to a foreign document" );
           }
  -            
  +
           Cursor cDst = (Cursor) dst;
  -                    
  +
           checkDisposed( cDst );
  -            
  +
           Splay sDst = cDst.getSplay();
           int   pDst = cDst.getPos();
  -                    
  +
           Splay s = getSplay();
           int   p = getPos();
  -            
  +
           if (s.checkInsertionValidity( p, sDst, pDst, true ))
               return copyCharsImpl( getPostCch(), dst ) > 0;
  -            
  +
           assert p == 0;
  -            
  +
           // Need to make a splay copy before getting the text because the copy
           // will validate invalid contents/values
  -                    
  +
           Root r = getRoot();
           Root rDst = cDst.getRoot();
  -                    
  +
           Splay copy = s.copySplay();
   
           Object txt = r._text;
  @@ -2579,12 +2579,12 @@
           //
           // Remove text after which might be between leaf value and first attr value
           //
  -        
  +
           if (s.isLeaf() && s.getCchAfter() > 0)
           {
               int cchValue = s.getCchValue();
               int cchAfter = s.getCchAfter();
  -            
  +
               if (cchValue == 0)
                   cp += cchAfter;
               else if (s.nextSplay().isAttr())
  @@ -2597,28 +2597,28 @@
                   cp = 0;
               }
           }
  -            
  +
           sDst.insert( rDst, pDst, copy, txt, cp, cch, true );
  -            
  +
           return true;
       }
  -    
  +
       public boolean removeXmlContents ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               // TODO - should implement this with internals
  -            
  +
               if (!isContainer())
                   return false;
  -    
  +
               TokenType tt = toFirstContentToken();
               assert !tt.isNone();
  -    
  +
               boolean removed = !isFinish();
  -            
  +
               try
               {
                   while ( !isFinish() )
  @@ -2631,7 +2631,7 @@
               {
                   toParent();
               }
  -    
  +
               return removed;
           }
       }
  @@ -2659,12 +2659,12 @@
   
           return false;
       }
  -    
  +
       public boolean moveXmlContents ( XmlCursor dst )
       {
           if (dst == null)
               throw new IllegalArgumentException( "Destination is null" );
  -        
  +
           if (dst.monitor() == monitor())
           {
               synchronized ( monitor() )
  @@ -2685,7 +2685,7 @@
                       {
                           GlobalLock.release();
                           acquired = false;
  -                        
  +
                           return moveXmlContentsImpl( dst );
                       }
                   }
  @@ -2701,30 +2701,30 @@
               }
           }
       }
  -    
  +
       private boolean moveXmlContentsImpl ( XmlCursor dst )
       {
           checkDisposed();
  -                    
  +
           if (!isContainer())
               return false;
  -            
  +
           // Check to see if dst is in src!  In this case, there is nothing to
           // do.
  -                    
  +
           if (contains( dst ))
               return false;
  -            
  +
           TokenType tt = toFirstContentToken();
           assert !tt.isNone();
  -                    
  +
           boolean moved = !isFinish();
  -                    
  +
           try
           {
               if (!moveXmlImpl( dst ))
                   return false;
  -                        
  +
               while ( !isFinish() )
               {
                   boolean b = moveXmlImpl( dst );
  @@ -2735,7 +2735,7 @@
           {
               toParent();
           }
  -            
  +
           return moved;
       }
   
  @@ -2743,7 +2743,7 @@
       {
           if (dst == null)
               throw new IllegalArgumentException( "Destination is null" );
  -        
  +
           if (dst.monitor() == monitor())
           {
               synchronized ( monitor() )
  @@ -2764,7 +2764,7 @@
                       {
                           GlobalLock.release();
                           acquired = false;
  -                        
  +
                           return copyXmlContentsImpl( dst );
                       }
                   }
  @@ -2780,55 +2780,55 @@
               }
           }
       }
  -    
  +
       private boolean copyXmlContentsImpl ( XmlCursor dst )
       {
           checkDisposed();
  -                    
  +
           if (!isContainer())
               return false;
  -            
  +
           // Check to see if dst is in src!  In this case, copy the src to a new
           // document and then move the copied contents to the destination.
  -            
  +
           if (contains( dst ))
           {
               XmlCursor cTmp = XmlObject.Factory.newInstance().newCursor();
  -            
  +
               cTmp.toNextToken();
  -            
  +
               if (!copyXmlContentsImpl( cTmp ))
               {
                   cTmp.dispose();
                   return false;
               }
  -            
  +
               cTmp.toStartDoc();
               ((Cursor)cTmp).moveXmlContentsImpl( dst );
               cTmp.dispose();
               return true;
           }
  -            
  +
           TokenType tt = toFirstContentToken();
           assert !tt.isNone();
  -                    
  +
           boolean copied = !isFinish();
  -                    
  +
           try
           {
               if (!copyXmlImpl( dst ))
                   return false;
  -            
  +
               for ( ; ; )
               {
                   if (isStart())
                       toEndToken();
  -                            
  +
                   toNextToken();
  -                            
  +
                   if (isFinish())
                       break;
  -            
  +
                   boolean b = copyXmlImpl( dst );
                   assert b;
               }
  @@ -2837,7 +2837,7 @@
           {
               toParent();
           }
  -            
  +
           return copied;
       }
   
  @@ -2846,14 +2846,14 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (xthat == null || !(xthat instanceof Cursor))
                   return false;
  -    
  +
               Cursor that = (Cursor) xthat;
  -    
  +
               checkDisposed( that );
  -            
  +
               return getRoot() == that.getRoot();
           }
       }
  @@ -2863,12 +2863,12 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               if (_stack == null)
                   _stack = new Selections();
  -    
  +
               _stack.add( getRoot(), getSplay(), getPos() );
  -    
  +
               getRoot().registerForChange( this );
           }
       }
  @@ -2878,51 +2878,51 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               if (_stack == null || _stack.size() == 0)
                   return false;
  -    
  +
               _stack.setCursor( this, _stack.size() - 1 );
  -    
  +
               _stack.pop();
  -    
  +
               return true;
           }
       }
  -    
  +
       public int getSelectionCount ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               return _selections == null ? 0 : _selections.size();
           }
       }
  -    
  +
       public boolean toSelection ( int i )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (_selections != null && i >= 0 && _selections.setCursor( this, i ))
               {
                   _currentSelection = i;
                   return true;
               }
  -    
  +
               return false;
           }
       }
  -    
  +
       public boolean hasNextSelection ( )
       {
           synchronized ( monitor() )
           {
               push();
               int currentSelection = _currentSelection;
  -    
  +
               try
               {
                   return toNextSelection();
  @@ -2934,26 +2934,26 @@
               }
           }
       }
  -    
  +
       public boolean toNextSelection ( )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (_selections == null || _currentSelection < -1)
                   return false;
  -    
  +
               int nextSelection = _currentSelection + 1;
  -    
  +
               if (!_selections.setCursor( this, nextSelection ))
               {
                   _currentSelection = -2;
                   return false;
               }
  -    
  +
               _currentSelection = nextSelection;
  -    
  +
               return true;
           }
       }
  @@ -2963,10 +2963,10 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               if (_selections != null)
                   _selections.dispose();
  -            
  +
               _currentSelection = -2;
           }
       }
  @@ -2976,19 +2976,19 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               if (_selections == null)
                   _selections = Path.newSelections();
  -    
  +
               // Force any selection engine to search all...
               _selections.size();
  -    
  +
               _selections.add( getRoot(), getSplay(), getPos() );
  -    
  +
               getRoot().registerForChange( this );
           }
       }
  -    
  +
       public void changeNotification ( )
       {
           if (_selections != null)
  @@ -3000,23 +3000,23 @@
           if (_stack != null)
               _stack.cursify( getRoot() );
       }
  -    
  +
       public void selectPath ( String path, XmlOptions options )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               if (_selections == null)
                   _selections = Path.newSelections();
               else
                   _selections.dispose();
  -    
  -            _selections.init( 
  +
  +            _selections.init(
                   Path.select( getRoot(), getSplay(), getPos(), path, options ) );
  -    
  +
               push();
  -    
  +
               if (_selections.setCursor( this, 0 ))
               {
                   getRoot().registerForChange( this );
  @@ -3024,26 +3024,26 @@
               }
               else
                   _currentSelection = -2;
  -    
  +
               pop();
           }
       }
  -    
  +
       public void selectPath ( String path )
       {
           selectPath( path, null );
       }
  -    
  +
       public XmlCursor execQuery ( String queryExpr, XmlOptions options )
       {
           synchronized ( monitor() )
           {
               checkDisposed();
  -    
  +
               return Path.query( this, queryExpr, options );
           }
       }
  -    
  +
       public XmlCursor execQuery ( String query )
       {
           return execQuery( query, null );
  @@ -3053,32 +3053,32 @@
       {
           return newDomNode( null );
       }
  -    
  +
       public Node newDomNode ( XmlOptions options )
       {
           try
           {
               Saver.DomSaver saver;
  -            
  +
               synchronized ( monitor() )
               {
                   checkDisposed();
  -                
  +
                   saver = new Saver.DomSaver(
                       getRoot(), getSplay(), getPos(), !isFragment(), options );
               }
  -            
  +
               return saver.exportDom();
           }
           catch ( Exception e )
           {
               if (e instanceof RuntimeException)
                   throw (RuntimeException) e;
  -            
  +
               throw new RuntimeException( e.getMessage(), e );
           }
       }
  -    
  +
       private boolean isFragment()
       {
           if (! isStartdoc())
  @@ -3147,12 +3147,12 @@
       {
           save( ch, lh, null );
       }
  -    
  +
       public void save ( File file ) throws IOException
       {
           save( file, null );
       }
  -    
  +
       public void save ( OutputStream os ) throws IOException
       {
           save( os, null );
  @@ -3174,11 +3174,11 @@
           synchronized ( monitor() )
           {
               checkDisposed();
  -            
  +
               new Saver.SaxSaver( getRoot(), getSplay(), getPos(), options, ch, lh );
           }
       }
  -    
  +
       public void save ( File file, XmlOptions options ) throws IOException
       {
           OutputStream os = new FileOutputStream( file );
  @@ -3192,7 +3192,7 @@
               os.close();
           }
       }
  -    
  +
       public void save ( OutputStream os, XmlOptions options ) throws IOException
       {
           // note that we do not hold the monitor for the duration of a save.
  @@ -3221,7 +3221,7 @@
               is.close();
           }
       }
  -    
  +
       public void save ( Writer w, XmlOptions options ) throws IOException
       {
           Reader r = newReader( options );
  @@ -3249,7 +3249,7 @@
       //
       //
       //
  -    
  +
       private boolean validate ( )
       {
           assert _goober.getRoot().validate();
  @@ -3269,30 +3269,30 @@
           void init ( PathEngine pathEngine )
           {
               dispose();
  -            
  +
               _pathEngine = pathEngine;
           }
  -        
  +
           void add ( Root r, Splay s )
           {
               add( r, s, 0 );
           }
  -        
  +
           void add ( Root r, Splay s, int p )
           {
               assert s.getRootSlow() == r;
  -            
  +
               if (_cursors != null)
               {
                   CursorGoober g = new CursorGoober( r );
   
                   g.set( s, p );
  -                
  +
                   _cursors.add( g );
   
                   return;
               }
  -            
  +
               if (_splays == null)
               {
                   assert _count == 0;
  @@ -3303,10 +3303,10 @@
               {
                   Splay[] newSplays = new Splay [ _count * 2 ];
                   int[]   newPositions = new int [ _count * 2 ];
  -                
  +
                   System.arraycopy( _splays, 0, newSplays, 0, _count );
                   System.arraycopy( _positions, 0, newPositions, 0, _count );
  -                
  +
                   _splays = newSplays;
                   _positions = newPositions;
               }
  @@ -3337,13 +3337,13 @@
                   return;
   
               _cursors = new ArrayList();
  -            
  +
               for ( int i = 0 ; i < _count ; i++ )
               {
                   CursorGoober g = new CursorGoober( r );
   
                   g.set( _splays[ i ], _positions[ i ] );
  -                
  +
                   _cursors.add( g );
               }
   
  @@ -3380,7 +3380,7 @@
   
               if (i >= currentSize())
                   return false;
  -            
  +
               if (_cursors != null)
               {
                   assert i < _cursors.size();
  @@ -3401,14 +3401,14 @@
               {
                   for ( int i = 0 ; i < _cursors.size() ; i++ )
                       ((CursorGoober) _cursors.get( i )).set( null, 0 );
  -                
  +
                   _cursors.clear();
  -                
  +
                   _cursors = null;
               }
  -            
  +
               _count = 0;
  -                
  +
               // TODO - cache unused Seleciton objects for later reuse
           }
   
  @@ -3420,7 +3420,7 @@
   
           private PathEngine _pathEngine;
       }
  -    
  +
       //
       // XMLStreamReader
       //
  @@ -3442,23 +3442,23 @@
           //
           // XMLStreamReader methods
           //
  -        
  +
           public void close ( )
           {
               checkChanged();
           }
  -        
  +
           public Location getLocation ( )
           {
               checkChanged();
  -            
  +
               XmlCursor c = getCursor();
   
               XmlLineNumber ln = (XmlLineNumber) c.getBookmark( XmlLineNumber.class );
   
  -            // BUGBUG - put source name here 
  +            // BUGBUG - put source name here
               _uri = null;
  -            
  +
               if (ln != null)
               {
                   _line = ln.getLine();
  @@ -3474,25 +3474,25 @@
   
               return this;
           }
  -        
  +
           public NamespaceContext getNamespaceContext ( )
           {
               checkChanged();
  -            
  +
               return this;
           }
   
           public Object getProperty ( String name )
           {
               checkChanged();
  -            
  +
               throw new RuntimeException( "Not implemented" );
           }
  -        
  +
           public String getCharacterEncodingScheme ( )
           {
               checkChanged();
  -            
  +
               XmlDocumentProperties props = getCursor().documentProperties();
   
               return props == null ? null : props.getEncoding();
  @@ -3501,30 +3501,30 @@
           public String getEncoding ( )
           {
               checkChanged();
  -            
  +
               return null;
           }
   
           public String getVersion ( )
           {
               checkChanged();
  -            
  +
               XmlDocumentProperties props = getCursor().documentProperties();
   
               return props == null ? null : props.getVersion();
           }
  -        
  +
           public boolean isStandalone ( )
           {
               checkChanged();
  -            
  +
               return false;
           }
  -        
  +
           public boolean standaloneSet ( )
           {
               checkChanged();
  -            
  +
               return false;
           }
   
  @@ -3532,17 +3532,17 @@
               throws XMLStreamException
           {
               checkChanged();
  -            
  +
               if (type != getEventType())
                   throw new XMLStreamException();
   
               if (namespaceURI != null && !getNamespaceURI().equals( namespaceURI ))
                   throw new XMLStreamException();
  -            
  +
               if (localName != null && !getLocalName().equals( localName ))
                   throw new XMLStreamException();
           }
  -        
  +
           //
           // Location and NamespaceContext methods
           //
  @@ -3551,11 +3551,11 @@
           public int    getColumnNumber    ( ) { return _column; }
           public int    getLineNumber      ( ) { return _line;   }
           public String getLocationURI     ( ) { return _uri;    }
  -        
  +
           public String getNamespaceURI ( String prefix )
           {
               checkChanged();
  -            
  +
               XmlCursor c = getCursor();
   
               boolean pop = false;
  @@ -3578,7 +3578,7 @@
           public String getPrefix ( String namespaceURI )
           {
               checkChanged();
  -            
  +
               XmlCursor c = getCursor();
   
               boolean pop = false;
  @@ -3605,9 +3605,9 @@
           public Iterator getPrefixes ( String namespaceURI )
           {
               checkChanged();
  -            
  +
               // BUGBUG - get only one for now ...
  -            
  +
               HashMap map = new HashMap();
   
               map.put( namespaceURI, getPrefix( namespaceURI ) );
  @@ -3629,16 +3629,16 @@
           String _uri;
           int _line, _column, _offset;
       }
  -        
  -    
  +
  +
       private static final class XMLStreamReaderForString extends XMLStreamReaderBase
       {
           XMLStreamReaderForString ( XmlCursor c, String s )
           {
               super( c );
  -            
  +
               _cursor = c;
  -            
  +
               _string = s == null ? "" : s;
           }
   
  @@ -3646,11 +3646,11 @@
           {
               return _cursor;
           }
  -        
  +
           //
           // Legal stream methods
           //
  -        
  +
           public int     getEventType      ( ) { checkChanged(); return CHARACTERS;            }
           public String  getText           ( ) { checkChanged(); return _string;               }
           public char[]  getTextCharacters ( ) { checkChanged(); return _string.toCharArray(); }
  @@ -3662,25 +3662,25 @@
           public boolean isCharacters      ( ) { checkChanged(); return true;                  }
           public boolean isEndElement      ( ) { checkChanged(); return false;                 }
           public boolean isStartElement    ( ) { checkChanged(); return false;                 }
  -        
  +
           public int getTextCharacters ( int sourceStart, char[] target, int targetStart, int length )
           {
               checkChanged();
  -            
  +
               int sourceEnd = sourceStart + length;
   
               if (sourceEnd >= _string.length())
                   sourceEnd = _string.length();
  -            
  +
               _string.getChars( sourceStart, sourceEnd, target, targetStart );
   
               return sourceEnd - sourceStart;
           }
  -        
  +
           public boolean isWhiteSpace ( )
           {
               checkChanged();
  -            
  +
               for ( int i = 0 ; i < _string.length() ; i++ )
               {
                   if (!Splay.isWhiteSpace( _string.charAt( i ) ))
  @@ -3689,11 +3689,11 @@
   
               return true;
           }
  -        
  +
           //
           // Illegal stream methods
           //
  -        
  +
           public int     getAttributeCount ( ) { throw new IllegalStateException(); }
           public String  getAttributeLocalName ( int index ) { throw new IllegalStateException(); }
           public QName   getAttributeName ( int index ) { throw new IllegalStateException(); }
  @@ -3715,11 +3715,11 @@
           public boolean isAttributeSpecified ( int index ) { throw new IllegalStateException(); }
           public int     next ( ) { throw new IllegalStateException(); }
           public int     nextTag ( ) { throw new IllegalStateException(); }
  -        
  +
           private XmlCursor _cursor;
           private String    _string;
       }
  -    
  +
       private static final class XMLStreamReaderImpl extends XMLStreamReaderBase
       {
           XMLStreamReaderImpl ( XmlCursor start, XmlCursor last )
  @@ -3737,22 +3737,22 @@
           {
               return _cursor;
           }
  -        
  +
           //
           //
           //
  -        
  +
           public boolean hasNext ( )
           {
               checkChanged();
  -            
  +
               return !_didLast;
           }
  -        
  +
           public int next ( )
           {
               checkChanged();
  -            
  +
               if (_didLast)
                   throw new IllegalStateException();
   
  @@ -3763,14 +3763,14 @@
   
               if (_cursor.isAtSamePositionAs( _last ))
                   _didLast = true;
  -            
  +
               return getEventType();
           }
  -        
  +
           public int getEventType ( )
           {
               checkChanged();
  -            
  +
               switch ( _cursor.currentTokenType().intValue() )
               {
               case TokenType.INT_STARTDOC  : return START_DOCUMENT;
  @@ -3782,17 +3782,17 @@
               case TokenType.INT_NAMESPACE : return NAMESPACE;
               case TokenType.INT_COMMENT   : return COMMENT;
               case TokenType.INT_PROCINST  : return PROCESSING_INSTRUCTION;
  -                                           
  +
               default                      : throw new IllegalStateException();
               }
           }
  -        
  +
           public int getAttributeCount ( )
           {
               checkChanged();
  -            
  +
               int count = 0;
  -            
  +
               if (_cursor.isAttr())
                   count = 1;
               else if (_cursor.isStart())
  @@ -3802,7 +3802,7 @@
                   for ( _cursor.toNextToken() ; _cursor.isAnyAttr() ; _cursor.toNextToken() )
                       if (_cursor.isAttr())
                           count++;
  -                
  +
                   _cursor.pop();
               }
               else
  @@ -3810,13 +3810,13 @@
   
               return count;
           }
  -        
  +
           public int getNamespaceCount ( )
           {
               checkChanged();
  -            
  +
               int count = 0;
  -            
  +
               if (_cursor.isNamespace())
                   count = 1;
               else if (_cursor.isStart())
  @@ -3826,7 +3826,7 @@
                   for ( _cursor.toNextToken() ; _cursor.isAnyAttr() ; _cursor.toNextToken() )
                       if (_cursor.isNamespace())
                           count++;
  -                
  +
                   _cursor.pop();
               }
               else
  @@ -3850,7 +3850,7 @@
                   for ( _cursor.toNextToken() ; _cursor.isAnyAttr() ; _cursor.toNextToken() )
                       if (_cursor.isAttr() && index-- == 0)
                           return;
  -                
  +
                   throw new IllegalArgumentException();
               }
               else
  @@ -3872,7 +3872,7 @@
                   for ( _cursor.toNextToken() ; _cursor.isAnyAttr() ; _cursor.toNextToken() )
                       if (_cursor.isNamespace() && index-- == 0)
                           return;
  -                
  +
                   throw new IllegalArgumentException();
               }
               else
  @@ -3905,11 +3905,11 @@
               else
                   throw new IllegalStateException();
           }
  -        
  +
           public String getAttributeLocalName ( int index )
           {
               checkChanged();
  -            
  +
               _cursor.push();
   
               try
  @@ -3923,11 +3923,11 @@
                   _cursor.pop();
               }
           }
  -        
  +
           public QName getAttributeName ( int index )
           {
               checkChanged();
  -            
  +
               _cursor.push();
   
               try
  @@ -3941,11 +3941,11 @@
                   _cursor.pop();
               }
           }
  -        
  +
           public String getAttributeNamespace ( int index )
           {
               checkChanged();
  -            
  +
               _cursor.push();
   
               try
  @@ -3959,11 +3959,11 @@
                   _cursor.pop();
               }
           }
  -        
  +
           public String getAttributePrefix ( int index )
           {
               checkChanged();
  -            
  +
               _cursor.push();
   
               try
  @@ -3977,11 +3977,11 @@
                   _cursor.pop();
               }
           }
  -        
  +
           public String getAttributeType ( int index )
           {
               checkChanged();
  -            
  +
               _cursor.push();
   
               try
  @@ -3995,11 +3995,11 @@
                   _cursor.pop();
               }
           }
  -        
  +
           public String getAttributeValue ( int index )
           {
               checkChanged();
  -            
  +
               _cursor.push();
   
               try
  @@ -4013,11 +4013,11 @@
                   _cursor.pop();
               }
           }
  -        
  +
           public String getAttributeValue ( String namespaceURI, String localName )
           {
               checkChanged();
  -            
  +
               _cursor.push();
   
               try
  @@ -4032,11 +4032,11 @@
                   _cursor.pop();
               }
           }
  -        
  +
           public String getNamespacePrefix ( int index )
           {
               checkChanged();
  -            
  +
               _cursor.push();
   
               try
  @@ -4050,11 +4050,11 @@
                   _cursor.pop();
               }
           }
  -        
  +
           public String getNamespaceURI ( int index )
           {
               checkChanged();
  -            
  +
               _cursor.push();
   
               try
  @@ -4068,11 +4068,11 @@
                   _cursor.pop();
               }
           }
  -        
  +
           public String getElementText ( ) throws XMLStreamException
           {
               checkChanged();
  -            
  +
               if (!isStartElement())
                   throw new IllegalStateException();
   
  @@ -4090,10 +4090,10 @@
                       depth--;
                       continue;
                   }
  -                
  +
                   if (e == START_ELEMENT)
                       depth++;
  -                
  +
                   if (e != CHARACTERS)
                       throw new XMLStreamException();
   
  @@ -4106,7 +4106,7 @@
           private QName getElemName ( )
           {
               _cursor.push();
  -            
  +
               try
               {
                   if (_cursor.isEnd())
  @@ -4121,59 +4121,59 @@
                   _cursor.pop();
               }
           }
  -        
  +
           public QName getName ( )
           {
               checkChanged();
  -            
  +
               return getElemName();
           }
  -        
  +
           public String getLocalName ( )
           {
               checkChanged();
  -            
  +
               return getElemName().getLocalPart();
           }
  -        
  +
           public String getNamespaceURI ( )
           {
               checkChanged();
  -            
  +
               return getElemName().getNamespaceURI();
           }
  -        
  +
           public String getPIData ( )
           {
               checkChanged();
  -            
  +
               if (!_cursor.isProcinst())
                   throw new IllegalStateException();
   
               return _cursor.getTextValue();
           }
  -        
  +
           public String getPITarget ( )
           {
               checkChanged();
  -            
  +
               if (!_cursor.isProcinst())
                   throw new IllegalStateException();
   
               return _cursor.getName().getLocalPart();
           }
  -        
  +
           public String getPrefix ( )
           {
               checkChanged();
  -            
  +
               return getPrefix( getNamespaceURI() );
           }
  -        
  +
           public String getText ( )
           {
               checkChanged();
  -            
  +
               if (_cursor.isComment())
                   return _cursor.getTextValue();
   
  @@ -4182,21 +4182,21 @@
   
               throw new IllegalStateException();
           }
  -        
  +
           public char[] getTextCharacters ( )
           {
               checkChanged();
  -            
  +
               return getText().toCharArray();
           }
  -        
  +
           public int getTextCharacters ( int sourceStart, char[] target, int targetStart, int length )
           {
               checkChanged();
  -            
  +
               if (length < 0)
                   throw new IllegalStateException();
  -            
  +
               char[] chars = getTextCharacters();
   
               if (length > chars.length)
  @@ -4206,29 +4206,29 @@
   
               return length;
           }
  -        
  +
           public int getTextLength ( )
           {
               checkChanged();
  -            
  +
               return getText().length();
           }
  -        
  +
           public int getTextStart ( )
           {
               checkChanged();
  -            
  +
               return 0;
           }
  -        
  +
           public boolean hasName ( )
           {
               checkChanged();
  -            
  +
               try
               {
                   getName();
  -                
  +
                   return true;
               }
               catch ( IllegalStateException e )
  @@ -4236,15 +4236,15 @@
                   return false;
               }
           }
  -        
  +
           public boolean hasText ( )
           {
               checkChanged();
  -            
  +
               try
               {
                   getText();
  -                
  +
                   return true;
               }
               catch ( IllegalStateException e )
  @@ -4252,39 +4252,39 @@
                   return false;
               }
           }
  -        
  +
           public boolean isAttributeSpecified ( int index )
           {
               checkChanged();
  -            
  +
               return false;
           }
  -        
  +
           public boolean isCharacters ( )
           {
               checkChanged();
  -            
  +
               return _cursor.isText();
           }
  -        
  +
           public boolean isEndElement ( )
           {
               checkChanged();
  -            
  +
               return _cursor.isEnd();
           }
  -        
  +
           public boolean isStartElement ( )
           {
               checkChanged();
  -            
  +
               return _cursor.isStart();
           }
  -        
  +
           public boolean isWhiteSpace ( )
           {
               checkChanged();
  -            
  +
               try
               {
                   String s = getText();
  @@ -4302,11 +4302,11 @@
                   return false;
               }
           }
  -        
  +
           public int nextTag ( ) throws XMLStreamException
           {
               checkChanged();
  -            
  +
               for ( ; ; )
               {
                   if (isStartElement() || isEndElement())
  @@ -4321,13 +4321,13 @@
                   next();
               }
           }
  -        
  +
           XmlCursor _cursor;
           XmlCursor _last;
  -        
  +
           boolean   _didLast;
       }
  -    
  +
       //
       //
       //
  @@ -4335,7 +4335,7 @@
       final CursorGoober _goober;
   
       private Selections _stack;
  -    
  +
       private Selections _selections;
       private int        _currentSelection;
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org


Mime
View raw message