Save This Page
Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.impl » store » [javadoc | source]
    1   /*   Copyright 2004 The Apache Software Foundation
    2    *
    3    *   Licensed under the Apache License, Version 2.0 (the "License");
    4    *   you may not use this file except in compliance with the License.
    5    *   You may obtain a copy of the License at
    6    *
    7    *       http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    *   Unless required by applicable law or agreed to in writing, software
   10    *   distributed under the License is distributed on an "AS IS" BASIS,
   11    *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12    *   See the License for the specific language governing permissions and
   13    *  limitations under the License.
   14    */
   15   
   16   package org.apache.xmlbeans.impl.store;
   17   
   18   import org.w3c.dom.Attr;
   19   import org.w3c.dom.CDATASection;
   20   import org.w3c.dom.CharacterData;
   21   import org.w3c.dom.Comment;
   22   import org.w3c.dom.Document;
   23   import org.w3c.dom.DocumentFragment;
   24   import org.w3c.dom.DocumentType;
   25   import org.w3c.dom.DOMException;
   26   import org.w3c.dom.DOMImplementation;
   27   import org.w3c.dom.Element;
   28   import org.w3c.dom.EntityReference;
   29   import org.w3c.dom.NamedNodeMap;
   30   import org.w3c.dom.Node;
   31   import org.w3c.dom.NodeList;
   32   import org.w3c.dom.ProcessingInstruction;
   33   import org.w3c.dom.Text;
   34   import org.w3c.dom.DOMImplementation;
   35   
   36   // DOM Level 3
   37   import org.w3c.dom.UserDataHandler;
   38   import org.w3c.dom.DOMConfiguration;
   39   import org.w3c.dom.TypeInfo;
   40   
   41   
   42   import javax.xml.transform.Source;
   43   
   44   import java.io.PrintStream;
   45   
   46   import java.util.Iterator;
   47   import java.util.Map;
   48   import java.util.ArrayList;
   49   import java.util.List;
   50   import java.util.Vector;
   51   
   52   import org.apache.xmlbeans.impl.soap.Detail;
   53   import org.apache.xmlbeans.impl.soap.DetailEntry;
   54   import org.apache.xmlbeans.impl.soap.MimeHeaders;
   55   import org.apache.xmlbeans.impl.soap.Name;
   56   import org.apache.xmlbeans.impl.soap.SOAPBody;
   57   import org.apache.xmlbeans.impl.soap.SOAPBodyElement;
   58   import org.apache.xmlbeans.impl.soap.SOAPElement;
   59   import org.apache.xmlbeans.impl.soap.SOAPEnvelope;
   60   import org.apache.xmlbeans.impl.soap.SOAPException;
   61   import org.apache.xmlbeans.impl.soap.SOAPFactory;
   62   import org.apache.xmlbeans.impl.soap.SOAPFault;
   63   import org.apache.xmlbeans.impl.soap.SOAPFaultElement;
   64   import org.apache.xmlbeans.impl.soap.SOAPHeader;
   65   import org.apache.xmlbeans.impl.soap.SOAPHeaderElement;
   66   import org.apache.xmlbeans.impl.soap.SOAPPart;
   67   import org.apache.xmlbeans.impl.store.Locale.LoadContext;
   68   
   69   import org.apache.xmlbeans.impl.store.DomImpl.Dom;
   70   import org.apache.xmlbeans.impl.store.DomImpl.CharNode;
   71   import org.apache.xmlbeans.impl.store.DomImpl.TextNode;
   72   import org.apache.xmlbeans.impl.store.DomImpl.CdataNode;
   73   import org.apache.xmlbeans.impl.store.DomImpl.SaajTextNode;
   74   import org.apache.xmlbeans.impl.store.DomImpl.SaajCdataNode;
   75   
   76   import org.apache.xmlbeans.XmlBeans;
   77   import org.apache.xmlbeans.SchemaField;
   78   import org.apache.xmlbeans.SchemaType;
   79   import org.apache.xmlbeans.SchemaTypeLoader;
   80   import org.apache.xmlbeans.XmlCursor;
   81   import org.apache.xmlbeans.XmlCursor.XmlMark;
   82   import org.apache.xmlbeans.XmlOptions;
   83   import org.apache.xmlbeans.XmlObject;
   84   import org.apache.xmlbeans.XmlException;
   85   import org.apache.xmlbeans.QNameSet;
   86   
   87   import org.apache.xmlbeans.impl.values.TypeStore;
   88   import org.apache.xmlbeans.impl.values.TypeStoreUser;
   89   import org.apache.xmlbeans.impl.values.TypeStoreVisitor;
   90   import org.apache.xmlbeans.impl.values.TypeStoreUserFactory;
   91   
   92   import javax.xml.namespace.QName;
   93   
   94   import org.apache.xmlbeans.impl.common.ValidatorListener;
   95   import org.apache.xmlbeans.impl.common.XmlLocale;
   96   import org.apache.xmlbeans.impl.common.QNameHelper;
   97   
   98   abstract class Xobj implements TypeStore
   99   {
  100       static final int TEXT     = Cur.TEXT;
  101       static final int ROOT     = Cur.ROOT;
  102       static final int ELEM     = Cur.ELEM;
  103       static final int ATTR     = Cur.ATTR;
  104       static final int COMMENT  = Cur.COMMENT;
  105       static final int PROCINST = Cur.PROCINST;
  106   
  107       static final int END_POS = Cur.END_POS;
  108       static final int NO_POS  = Cur.NO_POS;
  109   
  110       Xobj ( Locale l, int kind, int domType )
  111       {
  112           assert kind == ROOT || kind == ELEM || kind == ATTR || kind == COMMENT || kind == PROCINST;
  113   
  114           _locale = l;
  115           _bits = (domType << 4) + kind;
  116       }
  117   
  118       final boolean entered ( ) { return _locale.entered(); }
  119   
  120       final int kind    ( ) { return _bits & 0xF; }
  121       final int domType ( ) { return (_bits & 0xF0) >> 4; }
  122   
  123       final boolean isRoot      ( ) { return kind() == ROOT; }
  124       final boolean isAttr      ( ) { return kind() == ATTR; }
  125       final boolean isElem      ( ) { return kind() == ELEM; }
  126       final boolean isProcinst  ( ) { return kind() == PROCINST; }
  127       final boolean isComment   ( ) { return kind() == COMMENT; }
  128       final boolean isContainer ( ) { return Cur.kindIsContainer( kind() ); }
  129       final boolean isUserNode  ( ) { int k = kind(); return k == ELEM || k == ROOT || (k == ATTR && !isXmlns()); }
  130   
  131       final boolean isNormalAttr ( ) { return isAttr() && !Locale.isXmlns( _name ); }
  132       final boolean isXmlns      ( ) { return isAttr() &&  Locale.isXmlns( _name ); }
  133   
  134       final int cchValue ( ) { return _cchValue; }
  135       final int cchAfter ( ) { return _cchAfter; }
  136   
  137       final int posAfter ( ) { return 2 + _cchValue; }
  138       final int posMax   ( ) { return 2 + _cchValue + _cchAfter; }
  139   
  140       final String getXmlnsPrefix ( ) { return Locale.xmlnsPrefix( _name ); }
  141       final String getXmlnsUri    ( ) { return getValueAsString(); }
  142   
  143       final boolean hasTextEnsureOccupancy ( )
  144       {
  145           ensureOccupancy();
  146           return hasTextNoEnsureOccupancy();
  147       }
  148   
  149       final boolean hasTextNoEnsureOccupancy ( )
  150       {
  151           if (_cchValue > 0)
  152               return true;
  153   
  154           Xobj lastAttr = lastAttr();
  155   
  156           return lastAttr != null && lastAttr._cchAfter > 0;
  157       }
  158   
  159       final boolean hasAttrs    ( ) { return _firstChild != null &&  _firstChild.isAttr(); }
  160       final boolean hasChildren ( ) { return _lastChild  != null && !_lastChild .isAttr(); }
  161   
  162   
  163       /**
  164        * this method is to speed up DomImpl
  165        * when underlying obj is an Xobj
  166        *
  167        * @return 0 or 1 dom children; val 2 indicates that DomImpl needs to
  168        *         compute the result itself
  169        */
  170       final protected int getDomZeroOneChildren()
  171       {
  172           if (_firstChild == null &&
  173               _srcValue == null &&
  174               _charNodesValue == null)
  175               return 0;
  176   
  177           if (_lastChild != null &&
  178               _lastChild.isAttr() &&
  179               _lastChild._charNodesAfter == null &&
  180               _lastChild._srcAfter == null &&
  181               _srcValue == null &&
  182               _charNodesValue == null
  183           )
  184               return 0;
  185   
  186           if (_firstChild == _lastChild &&
  187               _firstChild != null &&
  188               !_firstChild.isAttr() &&
  189               _srcValue == null &&
  190               _charNodesValue == null &&
  191               _firstChild._srcAfter == null
  192           )
  193               return 1;
  194   
  195           if (_firstChild == null &&
  196               _srcValue != null &&
  197              ( _charNodesValue == null ||
  198               (_charNodesValue._next == null &&
  199               _charNodesValue._cch == _cchValue))
  200           )
  201               return 1;
  202           //single elem after an attr
  203           Xobj lastAttr = lastAttr();
  204           Xobj node = lastAttr == null ?
  205               null : lastAttr._nextSibling;
  206           if (lastAttr != null &&
  207               lastAttr._srcAfter == null &&
  208               node != null &&
  209               node._srcAfter == null &&
  210               node._nextSibling == null)
  211               return 1;
  212   
  213           return 2;
  214       }
  215   
  216       /**
  217        * can one use the _firstChild pointer to retrieve
  218        * the first DOM child
  219        *
  220        * @return
  221        */
  222       final protected boolean isFirstChildPtrDomUsable()
  223       {
  224           if (_firstChild == null &&
  225               _srcValue == null &&
  226               _charNodesValue == null)
  227               return true;
  228   
  229           if (_firstChild != null &&
  230               !_firstChild.isAttr() &&
  231               _srcValue == null &&
  232               _charNodesValue == null)
  233           {
  234               assert (_firstChild instanceof Xobj.NodeXobj):
  235                   "wrong node type";
  236               return true;
  237           }
  238           return false;
  239       }
  240   
  241       /**
  242        * can one use the _nextSibling pointer to retrieve
  243        *  the next DOM sibling
  244        * @return
  245        */
  246       final protected boolean isNextSiblingPtrDomUsable()
  247       {
  248           if (_charNodesAfter == null &&
  249               _srcAfter == null)
  250           {
  251               assert (_nextSibling == null ||
  252                   _nextSibling instanceof Xobj.NodeXobj):
  253                   "wrong node type";
  254               return true;
  255           }
  256           return false;
  257       }
  258       /**
  259        * can one use the _charNodesValue pointer to retrieve
  260        * the next DOM sibling
  261        *
  262        * @return
  263        */
  264       final protected boolean isExistingCharNodesValueUsable()
  265       {
  266           if (_srcValue == null) return false;
  267           if (_charNodesValue != null && _charNodesValue._next == null
  268               && _charNodesValue._cch == _cchValue)
  269               return true;
  270          return false;
  271       }
  272         final protected boolean isCharNodesValueUsable()
  273         {
  274             return isExistingCharNodesValueUsable() ||
  275                 (_charNodesValue =
  276                 Cur.updateCharNodes(_locale, this,
  277                     _charNodesValue, _cchValue)) != null;
  278         }
  279   
  280       /**
  281        * can one use the _charNodesAfter pointer to retrieve
  282        * the next DOM sibling
  283        *
  284        * @return
  285        */
  286       final protected boolean isCharNodesAfterUsable()
  287       {
  288           if (_srcAfter == null) return false;
  289           if (_charNodesAfter != null && _charNodesAfter._next == null
  290               && _charNodesAfter._cch == this._cchAfter)
  291               return true;
  292           return (_charNodesAfter =
  293               Cur.updateCharNodes(_locale, this,
  294                   _charNodesAfter, _cchAfter)) != null;
  295       }
  296   
  297   
  298       final Xobj lastAttr ( )
  299       {
  300           if (_firstChild == null || !_firstChild.isAttr())
  301               return null;
  302   
  303           Xobj lastAttr = _firstChild;
  304   
  305           while ( lastAttr._nextSibling != null && lastAttr._nextSibling.isAttr() )
  306               lastAttr = lastAttr._nextSibling;
  307   
  308           return lastAttr;
  309       }
  310   
  311       abstract Dom getDom ( );
  312   
  313       abstract Xobj newNode ( Locale l );
  314   
  315       final int cchLeft ( int p )
  316       {
  317           if (isRoot() && p == 0)
  318               return 0;
  319   
  320           Xobj x = getDenormal( p );
  321   
  322           p = posTemp();
  323           int pa = x.posAfter();
  324   
  325           return p - (p < pa ? 1 : pa);
  326       }
  327   
  328       final int cchRight ( int p )
  329       {
  330           assert p < posMax();
  331   
  332           if (p <= 0)
  333               return 0;
  334   
  335           int pa = posAfter();
  336   
  337           return p < pa ? pa - p - 1 : posMax() - p;
  338       }
  339   
  340       //
  341       // Dom interface
  342       //
  343   
  344       public final Locale locale   ( ) { return _locale;   }
  345       public final int    nodeType ( ) { return domType(); }
  346       public final QName  getQName ( ) { return _name;     }
  347   
  348       public final Cur tempCur ( ) { Cur c = _locale.tempCur(); c.moveTo( this ); return c; }
  349   
  350       public void dump ( PrintStream o, Object ref ) { Cur.dump( o, (Xobj) this, ref ); }
  351       public void dump ( PrintStream o ) { Cur.dump( o, this, this ); }
  352       public void dump ( ) { dump( System.out ); }
  353   
  354       //
  355       //
  356       //
  357   
  358       final Cur getEmbedded ( )
  359       {
  360           _locale.embedCurs();
  361   
  362           return _embedded;
  363       }
  364   
  365       // Incoming p must be at text (implicitly denormalized)
  366   
  367       final boolean inChars ( int p, Xobj xIn, int pIn, int cch, boolean includeEnd )
  368       {
  369           assert p > 0 && p < posMax() && p != posAfter() - 1 && cch > 0;
  370           assert xIn.isNormal( pIn );
  371   
  372           // No need to denormalize "in" if the right hand side is excluded.  Denormalizing deals
  373           // with the case where p is END_POS.
  374   
  375           int offset;
  376   
  377           if (includeEnd)
  378           {
  379               // Can't denormalize at the beginning of the document
  380   
  381               if (xIn.isRoot() && pIn == 0)
  382                   return false;
  383   
  384               xIn = xIn.getDenormal( pIn );
  385               pIn = xIn.posTemp();
  386   
  387               offset = 1;
  388           }
  389           else
  390               offset = 0;
  391   
  392           return xIn == this && pIn >= p && pIn < p + (cch < 0 ? cchRight( p ) : cch) + offset;
  393       }
  394   
  395       // Is x/p just after the end of this
  396   
  397       final boolean isJustAfterEnd ( Xobj x, int p )
  398       {
  399           assert x.isNormal( p );
  400   
  401           // Get denormalize at the beginning of the doc
  402   
  403           if (x.isRoot() && p == 0)
  404               return false;
  405   
  406           return
  407               x == this
  408                   ? p == posAfter()
  409                   : x.getDenormal( p ) == this && x.posTemp() == posAfter();
  410       }
  411   
  412       final boolean isInSameTree ( Xobj x )
  413       {
  414           if (_locale != x._locale)
  415               return false;
  416   
  417           for ( Xobj y = this ; ; y = y._parent )
  418           {
  419               if (y == x)
  420                   return true;
  421   
  422               if (y._parent == null)
  423               {
  424                   for ( ; ; x = x._parent )
  425                   {
  426                       if (x == this)
  427                           return true;
  428   
  429                       if (x._parent == null)
  430                           return x == y;
  431                   }
  432               }
  433           }
  434       }
  435   
  436       final boolean contains ( Cur c )
  437       {
  438           assert c.isNormal();
  439   
  440           return contains( c._xobj, c._pos );
  441       }
  442   
  443       final boolean contains ( Xobj x, int p )
  444       {
  445           assert x.isNormal( p );
  446   
  447           if (this == x)
  448               return p == END_POS || (p > 0 && p < posAfter());
  449   
  450           if (_firstChild == null)
  451               return false;
  452   
  453           for ( ; x != null ; x = x._parent )
  454               if (x == this)
  455                   return true;
  456   
  457           return false;
  458       }
  459   
  460       final Bookmark setBookmark ( int p, Object key, Object value )
  461       {
  462           assert isNormal( p );
  463   
  464           for ( Bookmark b = _bookmarks ; b != null ; b = b._next )
  465           {
  466               if (p == b._pos && key == b._key)
  467               {
  468                   if (value == null)
  469                   {
  470                       _bookmarks = b.listRemove( _bookmarks );
  471                       return null;
  472                   }
  473   
  474                   b._value = value;
  475   
  476                   return b;
  477               }
  478           }
  479   
  480           if (value == null)
  481               return null;
  482   
  483           Bookmark b = new Bookmark();
  484   
  485           b._xobj  = this;
  486           b._pos   = p;
  487           b._key   = key;
  488           b._value = value;
  489   
  490           _bookmarks = b.listInsert( _bookmarks );
  491   
  492           return b;
  493       }
  494   
  495       final boolean hasBookmark(Object key, int pos)
  496       {
  497           for ( Bookmark b = _bookmarks ; b != null ; b = b._next )
  498               if ( b._pos == pos && key == b._key )
  499               {
  500                   //System.out.println("hasCDataBookmark  pos: " + pos + " xobj: " + getQName() + " b._pos: " + _bookmarks._pos);
  501                   return true;
  502               }
  503   
  504           return false;
  505       }
  506   
  507       final Xobj findXmlnsForPrefix ( String prefix )
  508       {
  509           assert isContainer() && prefix != null;
  510   
  511           for ( Xobj c = this ; c != null ; c = c._parent )
  512               for ( Xobj a = c.firstAttr() ; a != null ; a = a.nextAttr() )
  513                   if (a.isXmlns() && a.getXmlnsPrefix().equals( prefix ))
  514                       return a;
  515   
  516           return null;
  517       }
  518   
  519       final boolean removeAttr ( QName name )
  520       {
  521           assert isContainer();
  522   
  523           Xobj a = getAttr( name );
  524   
  525           if (a == null)
  526               return false;
  527   
  528           Cur c = a.tempCur();
  529   
  530           for ( ; ; )
  531           {
  532               c.moveNode( null );
  533   
  534               a = getAttr( name );
  535   
  536               if (a == null)
  537                   break;
  538   
  539               c.moveTo( a );
  540           }
  541   
  542           c.release();
  543   
  544           return true;
  545       }
  546   
  547       final Xobj setAttr ( QName name, String value )
  548       {
  549           assert isContainer();
  550   
  551           Cur c = tempCur();
  552   
  553           if (c.toAttr( name ))
  554               c.removeFollowingAttrs();
  555           else
  556           {
  557               c.next();
  558               c.createAttr( name );
  559           }
  560   
  561           c.setValue( value );
  562   
  563           Xobj a = c._xobj;
  564   
  565           c.release();
  566   
  567           return a;
  568       }
  569   
  570       final void setName ( QName newName )
  571       {
  572           assert isAttr() || isElem() || isProcinst();
  573           assert newName != null;
  574   
  575           if (!_name.equals( newName ) || !_name.getPrefix().equals( newName.getPrefix() ))
  576           {
  577   // TODO - this is not a structural change .... perhaps should not issue a change here?
  578               _locale.notifyChange();
  579   
  580               QName oldName = _name;
  581   
  582               _name = newName;
  583               if (this instanceof Xobj.NamedNodeXobj)
  584               {
  585                   NamedNodeXobj me = (NamedNodeXobj)this;
  586                   me._canHavePrefixUri = true;
  587               }
  588   
  589               if (!isProcinst())
  590               {
  591                   Xobj disconnectFromHere = this;
  592   
  593                   if (isAttr() && _parent != null)
  594                   {
  595                       if (oldName.equals( Locale._xsiType ) || newName.equals( Locale._xsiType ))
  596                           disconnectFromHere = _parent;
  597   
  598                       if (oldName.equals( Locale._xsiNil ) || newName.equals( Locale._xsiNil ))
  599                           _parent.invalidateNil();
  600                   }
  601   
  602                   disconnectFromHere.disconnectNonRootUsers();
  603               }
  604   
  605               _locale._versionAll++;
  606               _locale._versionSansText++;
  607           }
  608       }
  609   
  610       final Xobj ensureParent ( )
  611       {
  612           assert _parent != null || (!isRoot() && cchAfter() == 0);
  613           return _parent == null ? new DocumentFragXobj( _locale ).appendXobj( this ) : _parent;
  614       }
  615   
  616       final Xobj firstAttr ( )
  617       {
  618           return _firstChild == null || !_firstChild.isAttr() ? null : _firstChild;
  619       }
  620   
  621       final Xobj nextAttr ( )
  622       {
  623           if (_firstChild != null && _firstChild.isAttr())
  624               return _firstChild;
  625   
  626           if (_nextSibling != null && _nextSibling.isAttr())
  627               return _nextSibling;
  628   
  629           return null;
  630       }
  631   
  632       final boolean isValid ( )
  633       {
  634           if (isVacant() && (_cchValue != 0 || _user == null))
  635               return false;
  636   
  637           return true;
  638       }
  639   
  640       final int posTemp ( )
  641       {
  642           return _locale._posTemp;
  643       }
  644   
  645       final Xobj getNormal ( int p )
  646       {
  647           assert p == END_POS || (p >= 0 && p <= posMax());
  648   
  649           Xobj x = this;
  650   
  651           if (p == x.posMax())
  652           {
  653               if (x._nextSibling != null)
  654               {
  655                   x = x._nextSibling;
  656                   p = 0;
  657               }
  658               else
  659               {
  660                   x = x.ensureParent();
  661                   p = END_POS;
  662               }
  663           }
  664           else if (p == x.posAfter() - 1)
  665               p = END_POS;
  666   
  667           _locale._posTemp = p;
  668   
  669           return x;
  670       }
  671   
  672       // Can't denormalize a position at the very beginning of the document.  No where to go to the
  673       // left!
  674   
  675       final Xobj getDenormal ( int p )
  676       {
  677           assert END_POS == -1;
  678           assert !isRoot() || p == END_POS || p > 0;
  679   
  680           Xobj x = this;
  681   
  682           if (p == 0)
  683           {
  684               if (x._prevSibling == null)
  685               {
  686                   x = x.ensureParent();
  687                   p = x.posAfter() - 1;
  688               }
  689               else
  690               {
  691                   x = x._prevSibling;
  692                   p = x.posMax();
  693               }
  694           }
  695           else if (p == END_POS)
  696           {
  697               if (x._lastChild == null)
  698                   p = x.posAfter() - 1;
  699               else
  700               {
  701                   x = x._lastChild;
  702                   p = x.posMax();
  703               }
  704           }
  705   
  706           _locale._posTemp = p;
  707   
  708           return x;
  709       }
  710   
  711       final boolean isNormal ( int p )
  712       {
  713           if (!isValid())
  714               return false;
  715   
  716           if (p == END_POS || p == 0)
  717               return true;
  718   
  719           if (p < 0 || p >= posMax())
  720               return false;
  721   
  722           if (p >= posAfter())
  723           {
  724               if (isRoot())
  725                   return false;
  726   
  727               if (_nextSibling != null && _nextSibling.isAttr())
  728                   return false;
  729   
  730               if (_parent == null || !_parent.isContainer())
  731                   return false;
  732           }
  733   
  734           if (p == posAfter() - 1)
  735               return false;
  736   
  737           return true;
  738       }
  739   
  740       final Xobj walk ( Xobj root, boolean walkChildren )
  741       {
  742           if (_firstChild != null && walkChildren)
  743               return _firstChild;
  744   
  745           for ( Xobj x = this ; x != root ; x = x._parent )
  746               if (x._nextSibling != null)
  747                   return x._nextSibling;
  748   
  749           return null;
  750       }
  751   
  752       final Xobj removeXobj ( )
  753       {
  754           if (_parent != null)
  755           {
  756               if (_parent._firstChild == this)
  757                   _parent._firstChild = _nextSibling;
  758   
  759               if (_parent._lastChild == this)
  760                   _parent._lastChild = _prevSibling;
  761   
  762               if (_prevSibling != null)
  763                   _prevSibling._nextSibling = _nextSibling;
  764   
  765               if (_nextSibling != null)
  766                   _nextSibling._prevSibling = _prevSibling;
  767   
  768               _parent = null;
  769               _prevSibling = null;
  770               _nextSibling = null;
  771           }
  772   
  773           return this;
  774       }
  775   
  776       final Xobj insertXobj ( Xobj s )
  777       {
  778           assert _locale == s._locale;
  779           assert !s.isRoot() && !isRoot();
  780           assert s._parent == null;
  781           assert s._prevSibling == null;
  782           assert s._nextSibling == null;
  783   
  784           ensureParent();
  785   
  786           s._parent = _parent;
  787           s._prevSibling = _prevSibling;
  788           s._nextSibling = this;
  789   
  790           if (_prevSibling != null)
  791               _prevSibling._nextSibling = s;
  792           else
  793               _parent._firstChild = s;
  794   
  795           _prevSibling = s;
  796   
  797           return this;
  798       }
  799   
  800       final Xobj appendXobj ( Xobj c )
  801       {
  802           assert _locale == c._locale;
  803           assert !c.isRoot();
  804           assert c._parent == null;
  805           assert c._prevSibling == null;
  806           assert c._nextSibling == null;
  807           assert _lastChild == null || _firstChild != null;
  808   
  809           c._parent = this;
  810           c._prevSibling = _lastChild;
  811   
  812           if (_lastChild == null)
  813               _firstChild = c;
  814           else
  815               _lastChild._nextSibling = c;
  816   
  817           _lastChild = c;
  818   
  819           return this;
  820       }
  821   
  822       final void removeXobjs ( Xobj first, Xobj last )
  823       {
  824           assert last._locale == first._locale;
  825           assert first._parent == this;
  826           assert last._parent == this;
  827   
  828           if (_firstChild == first)
  829               _firstChild = last._nextSibling;
  830   
  831           if (_lastChild == last)
  832               _lastChild = first._prevSibling;
  833   
  834           if (first._prevSibling != null)
  835               first._prevSibling._nextSibling = last._nextSibling;
  836   
  837           if (last._nextSibling != null)
  838               last._nextSibling._prevSibling = first._prevSibling;
  839   
  840           // Leave the children linked together
  841   
  842           first._prevSibling = null;
  843           last._nextSibling = null;
  844   
  845           for ( ; first != null ; first = first._nextSibling )
  846               first._parent = null;
  847       }
  848   
  849       final void insertXobjs ( Xobj first, Xobj last )
  850       {
  851           assert _locale == first._locale;
  852           assert last._locale == first._locale;
  853           assert first._parent == null && last._parent == null;
  854           assert first._prevSibling == null;
  855           assert last._nextSibling == null;
  856   
  857           first._prevSibling = _prevSibling;
  858           last._nextSibling = this;
  859   
  860           if (_prevSibling != null)
  861               _prevSibling._nextSibling = first;
  862           else
  863               _parent._firstChild = first;
  864   
  865           _prevSibling = last;
  866   
  867           for ( ; first != this ; first = first._nextSibling )
  868               first._parent = _parent;
  869       }
  870   
  871       final void appendXobjs ( Xobj first, Xobj last )
  872       {
  873           assert _locale == first._locale;
  874           assert last._locale == first._locale;
  875           assert first._parent == null && last._parent == null;
  876           assert first._prevSibling == null;
  877           assert last._nextSibling == null;
  878           assert !first.isRoot();
  879   
  880           first._prevSibling = _lastChild;
  881   
  882           if (_lastChild == null)
  883               _firstChild = first;
  884           else
  885               _lastChild._nextSibling = first;
  886   
  887           _lastChild = last;
  888   
  889           for ( ; first != null ; first = first._nextSibling )
  890               first._parent = this;
  891       }
  892   
  893       static final void disbandXobjs ( Xobj first, Xobj last )
  894       {
  895           assert last._locale == first._locale;
  896           assert first._parent == null && last._parent == null;
  897           assert first._prevSibling == null;
  898           assert last._nextSibling == null;
  899           assert !first.isRoot();
  900   
  901           while ( first != null )
  902           {
  903               Xobj next = first._nextSibling;
  904               first._nextSibling = first._prevSibling = null;
  905               first = next;
  906           }
  907       }
  908   
  909       // Potential attr is going to be moved/removed, invalidate parent if it is a special attr
  910   
  911       final void invalidateSpecialAttr ( Xobj newParent )
  912       {
  913           if (isAttr())
  914           {
  915               if (_name.equals( Locale._xsiType ))
  916               {
  917                   if (_parent != null)
  918                       _parent.disconnectNonRootUsers();
  919   
  920                   if (newParent != null)
  921                       newParent.disconnectNonRootUsers();
  922               }
  923   
  924               if (_name.equals( Locale._xsiNil ))
  925               {
  926                   if (_parent != null)
  927                       _parent.invalidateNil();
  928   
  929                   if (newParent != null)
  930                       newParent.invalidateNil();
  931               }
  932           }
  933       }
  934   
  935       // Move or remove chars.  Incoming p is denormalized.  Incoming xTo and pTo are denormalized.
  936       // Option to move curs with text.  Option to perform invalidations.
  937       //
  938       // Important note: this fcn must operate under the assumption that the tree may be in an
  939       // invalid state.  Most likely, there may be text on two different nodes which should belong
  940       // on the same node.  Assertion of cursor normalization usually detects this problem.  Any of
  941       // the fcns it calls must also deal with these invalid conditions.  Try not to call so many
  942       // fcns from here.
  943   
  944       final void removeCharsHelper (
  945           int p, int cchRemove, Xobj xTo, int pTo, boolean moveCurs, boolean invalidate )
  946       {
  947           assert p > 0 && p < posMax() && p != posAfter() - 1;
  948           assert cchRemove > 0;
  949           assert cchRight( p ) >= cchRemove;
  950           assert !moveCurs || xTo != null;
  951   
  952           // Here I check the span of text to be removed for cursors.  If xTo/pTo is not specified,
  953           // then the caller wants these cursors to collapse to be after the text being removed.  If
  954           // the caller specifies moveCurs, then the caller has arranged for the text being removed
  955           // to have been copied to xTp/pTo and wants the cursors to be moved there as well.
  956           // Note that I call nextChars here.  I do this because trying to shift the cursor to the
  957           // end of the text to be removed with a moveTo could cause the improper placement of the
  958           // cursor just before an end tag, instead of placing it just before the first child.  Also,
  959           // I adjust all positions of curs after the text to be removed to account for the removal.
  960   
  961           for ( Cur c = getEmbedded() ; c != null ; )
  962           {
  963               Cur next = c._next;
  964   
  965               // Here I test to see if the Cur c is in the range of chars to be removed.  Normally
  966               // I would call inChars, but it can't handle the invalidity of the tree, so I heve
  967               // inlined the inChars logic here (includeEnd is false, makes it much simpler).
  968               // Note that I also call moveToNoCheck because the destination may have afterText
  969               // and no parent which will cause normaliztion checks in MoveTo to fail.  I don't think
  970               // that nextChars will be called under such circumstnaces.
  971   
  972               assert c._xobj == this;
  973   
  974               if (c._pos >= p && c._pos < p + cchRemove)
  975               {
  976                   if (moveCurs)
  977                       c.moveToNoCheck( xTo, pTo + c._pos - p );
  978                   else
  979                       c.nextChars( cchRemove - c._pos + p );
  980               }
  981   
  982               // If c is still on this Xobj and it's to the right of the chars to remove, adjust
  983               // it to adapt to the removal of the cars.  I don't have to worry about END_POS
  984               // here, just curs in text.
  985   
  986               if (c._xobj == this && c._pos >= p + cchRemove)
  987                   c._pos -= cchRemove;
  988   
  989               c = next;
  990           }
  991   
  992           // Here I move bookmarks in this text to the span of text at xTo/pTo.  The text at this/p
  993           // is going away, but a caller of this fcn who specifies xTo/pTo has copied the text to
  994           // xTo/pTo.  The caller has to make sure that if xTo/pTo is not specified, then there are
  995           // no bookmarks in the span of text to be removed.
  996   
  997           for ( Bookmark b = _bookmarks ; b != null ; )
  998           {
  999               Bookmark next = b._next;
 1000   
 1001               // Similarly, as above, I can't call inChars here
 1002   
 1003               assert b._xobj == this;
 1004   
 1005               if (b._pos >= p && b._pos < p + cchRemove)
 1006               {
 1007                   assert xTo != null;
 1008                   b.moveTo( xTo, pTo + b._pos - p );
 1009               }
 1010   
 1011               if (b._xobj == this && b._pos >= p + cchRemove)
 1012                   b._pos -= cchRemove;
 1013   
 1014               b = b._next;
 1015           }
 1016   
 1017           // Now, remove the actual chars
 1018   
 1019           int pa = posAfter();
 1020           CharUtil cu = _locale.getCharUtil();
 1021   
 1022           if (p < pa)
 1023           {
 1024               _srcValue = cu.removeChars( p - 1, cchRemove, _srcValue, _offValue, _cchValue );
 1025               _offValue = cu._offSrc;
 1026               _cchValue = cu._cchSrc;
 1027   
 1028               if (invalidate)
 1029               {
 1030                   invalidateUser();
 1031                   invalidateSpecialAttr( null );
 1032               }
 1033           }
 1034           else
 1035           {
 1036               _srcAfter = cu.removeChars( p - pa, cchRemove, _srcAfter, _offAfter, _cchAfter );
 1037               _offAfter = cu._offSrc;
 1038               _cchAfter = cu._cchSrc;
 1039   
 1040               if (invalidate && _parent != null)
 1041                   _parent.invalidateUser();
 1042           }
 1043       }
 1044   
 1045       // Insert chars into this xobj.  Incoming p is denormalized.  Update bookmarks and cursors.
 1046       // This fcn does not deal with occupation of the value, this needs to be handled by the
 1047       // caller.
 1048   
 1049       final void insertCharsHelper ( int p, Object src, int off, int cch, boolean invalidate )
 1050       {
 1051           assert p > 0;
 1052           assert p >= posAfter() || isOccupied();
 1053   
 1054           int pa = posAfter();
 1055   
 1056           // Here I shuffle bookmarks and cursors affected by the insertion of the new text.  Because
 1057           // getting the embedded cursors is non-trivial, I avoid getting them if I don't need to.
 1058           // Basically, I need to know if p is before any text in the node as a whole.  If it is,
 1059           // then there may be cursors/marks I need to shift right.
 1060   
 1061           if (p - (p < pa ? 1 : 2) < _cchValue + _cchAfter)
 1062           {
 1063               for ( Cur c = getEmbedded() ; c != null ; c = c._next )
 1064                   if (c._pos >= p)
 1065                       c._pos += cch;
 1066   
 1067               for ( Bookmark b = _bookmarks ; b != null ; b = b._next )
 1068                   if (b._pos >= p)
 1069                       b._pos += cch;
 1070           }
 1071   
 1072           // Now, stuff the new characters in!  Also invalidate the proper container and if the
 1073           // value of an attribute is changing, check for special attr invalidation.  Note that
 1074           // I do not assume that inserting after text will have a parent.  There are use cases
 1075           // from moveNodesContents which excersize this.
 1076   
 1077           CharUtil cu = _locale.getCharUtil();
 1078   
 1079           if (p < pa)
 1080           {
 1081               _srcValue = cu.insertChars( p - 1, _srcValue, _offValue, _cchValue, src, off, cch );
 1082               _offValue = cu._offSrc;
 1083               _cchValue = cu._cchSrc;
 1084   
 1085               if (invalidate)
 1086               {
 1087                   invalidateUser();
 1088                   invalidateSpecialAttr( null );
 1089               }
 1090           }
 1091           else
 1092           {
 1093               _srcAfter = cu.insertChars( p - pa, _srcAfter, _offAfter, _cchAfter, src, off, cch );
 1094               _offAfter = cu._offSrc;
 1095               _cchAfter = cu._cchSrc;
 1096   
 1097               if (invalidate && _parent != null)
 1098                   _parent.invalidateUser();
 1099           }
 1100       }
 1101   
 1102       Xobj copyNode ( Locale toLocale )
 1103       {
 1104           Xobj newParent = null;
 1105           Xobj copy = null;
 1106   
 1107           for ( Xobj x = this ; ; )
 1108           {
 1109               x.ensureOccupancy();
 1110   
 1111               Xobj newX = x.newNode( toLocale );
 1112   
 1113               newX._srcValue = x._srcValue;
 1114               newX._offValue = x._offValue;
 1115               newX._cchValue = x._cchValue;
 1116   
 1117               newX._srcAfter = x._srcAfter;
 1118               newX._offAfter = x._offAfter;
 1119               newX._cchAfter = x._cchAfter;
 1120   
 1121               // TODO - strange to have charNode stuff inside here .....
 1122              // newX._charNodesValue = CharNode.copyNodes( x._charNodesValue, newX._srcValue );
 1123              // newX._charNodesAfter = CharNode.copyNodes( x._charNodesAfter, newX._srcAfter );
 1124   
 1125               if (newParent == null)
 1126                   copy = newX;
 1127               else
 1128                   newParent.appendXobj( newX );
 1129   
 1130               // Walk to the next in-order xobj.  Record the current (y) to compute newParent
 1131   
 1132               Xobj y = x;
 1133   
 1134               if ((x = x.walk( this, true )) == null)
 1135                   break;
 1136   
 1137               if (y == x._parent)
 1138                   newParent = newX;
 1139               else
 1140                   for ( ; y._parent != x._parent ; y = y._parent )
 1141                       newParent = newParent._parent;
 1142           }
 1143   
 1144           copy._srcAfter = null;
 1145           copy._offAfter = 0;
 1146           copy._cchAfter = 0;
 1147   
 1148           return copy;
 1149       }
 1150   
 1151       // Rturns all the chars, even if there is text intermixed with children
 1152   
 1153       String getCharsAsString ( int p, int cch, int wsr )
 1154       {
 1155           if (cchRight( p ) == 0)
 1156               return "";
 1157   
 1158           Object src = getChars( p, cch );
 1159   
 1160           if (wsr == Locale.WS_PRESERVE)
 1161               return CharUtil.getString( src, _locale._offSrc, _locale._cchSrc );
 1162   
 1163           Locale.ScrubBuffer scrub = Locale.getScrubBuffer( wsr );
 1164   
 1165           scrub.scrub( src, _locale._offSrc, _locale._cchSrc );
 1166   
 1167           return scrub.getResultAsString();
 1168       }
 1169       String getCharsAfterAsString ( int off, int cch )
 1170       {
 1171          int offset = off + _cchValue + 2;
 1172           if (offset == posMax())
 1173               offset = -1;
 1174           return getCharsAsString(offset, cch,
 1175               Locale.WS_PRESERVE);
 1176       }
 1177       String getCharsValueAsString ( int off, int cch )
 1178       {
 1179          return getCharsAsString(off + 1, cch,
 1180                           Locale.WS_PRESERVE);
 1181       }
 1182       String getValueAsString ( int wsr )
 1183       {
 1184           if (!hasChildren())
 1185           {
 1186               Object src = getFirstChars();
 1187   
 1188               if (wsr == Locale.WS_PRESERVE)
 1189               {
 1190                   String s = CharUtil.getString( src, _locale._offSrc, _locale._cchSrc );
 1191   
 1192                   // Cache string to be able to use it later again
 1193   
 1194                   int cch = s.length();
 1195   
 1196                   if (cch > 0)
 1197                   {
 1198                       Xobj lastAttr = lastAttr();
 1199   
 1200                       assert (lastAttr == null ? _cchValue : lastAttr._cchAfter) == cch;
 1201   
 1202                       if (lastAttr != null)
 1203                       {
 1204                           lastAttr._srcAfter = s;
 1205                           lastAttr._offAfter = 0;
 1206                       }
 1207                       else
 1208                       {
 1209                           _srcValue = s;
 1210                           _offValue = 0;
 1211                       }
 1212                   }
 1213   
 1214                   return s;
 1215               }
 1216   
 1217               Locale.ScrubBuffer scrub = Locale.getScrubBuffer( wsr );
 1218   
 1219               scrub.scrub( src, _locale._offSrc, _locale._cchSrc );
 1220   
 1221               return scrub.getResultAsString();
 1222           }
 1223   
 1224           Locale.ScrubBuffer scrub = Locale.getScrubBuffer( wsr );
 1225   
 1226           Cur c = tempCur();
 1227   
 1228           c.push();
 1229   
 1230           for ( c.next() ; !c.isAtEndOfLastPush() ; )
 1231           {
 1232               if (c.isText())
 1233                   scrub.scrub( c.getChars( -1 ), c._offSrc, c._cchSrc );
 1234   
 1235               if (c.isComment() || c.isProcinst())
 1236                   c.skip();
 1237               else
 1238                   c.next();
 1239           }
 1240   
 1241           String s = scrub.getResultAsString();
 1242   
 1243           c.release();
 1244   
 1245           return s;
 1246       }
 1247   
 1248       String getValueAsString ( )
 1249       {
 1250           return getValueAsString( Locale.WS_PRESERVE );
 1251       }
 1252   
 1253       String getString ( int p, int cch )
 1254       {
 1255           int cchRight = cchRight( p );
 1256   
 1257           if (cchRight == 0)
 1258               return "";
 1259   
 1260           if (cch < 0 || cch > cchRight)
 1261               cch = cchRight;
 1262   
 1263           int pa = posAfter();
 1264   
 1265           assert p > 0;
 1266   
 1267           String s;
 1268   
 1269           if (p >= pa)
 1270           {
 1271               s = CharUtil.getString( _srcAfter, _offAfter + p - pa, cch );
 1272   
 1273               if (p == pa && cch == _cchAfter)
 1274               {
 1275                   _srcAfter = s;
 1276                   _offAfter = 0;
 1277               }
 1278           }
 1279           else
 1280           {
 1281               s = CharUtil.getString( _srcValue, _offValue + p - 1, cch );
 1282   
 1283               if (p == 1 && cch == _cchValue)
 1284               {
 1285                   _srcValue = s;
 1286                   _offValue = 0;
 1287               }
 1288           }
 1289   
 1290           return s;
 1291       }
 1292   
 1293       // Returns just chars just after the begin tag ... does not get all the text if there are
 1294       // children
 1295   
 1296       Object getFirstChars ( )
 1297       {
 1298           ensureOccupancy();
 1299   
 1300           if (_cchValue > 0)
 1301               return getChars( 1, -1 );
 1302   
 1303           Xobj lastAttr = lastAttr();
 1304   
 1305           if (lastAttr == null || lastAttr._cchAfter <= 0)
 1306           {
 1307               _locale._offSrc = 0;
 1308               _locale._cchSrc = 0;
 1309   
 1310               return null;
 1311           }
 1312   
 1313           return lastAttr.getChars( lastAttr.posAfter(), -1 );
 1314       }
 1315   
 1316       Object getChars ( int pos, int cch, Cur c )
 1317       {
 1318           Object src = getChars( pos, cch );
 1319   
 1320           c._offSrc = _locale._offSrc;
 1321           c._cchSrc = _locale._cchSrc;
 1322   
 1323           return src;
 1324       }
 1325   
 1326       // These return the remainder of the char triple that getChars starts
 1327   
 1328       Object getChars ( int pos, int cch )
 1329       {
 1330           assert isNormal( pos );
 1331   
 1332           int cchRight = cchRight( pos );
 1333   
 1334           if (cch < 0 || cch > cchRight)
 1335               cch = cchRight;
 1336   
 1337           if (cch == 0)
 1338           {
 1339               _locale._offSrc = 0;
 1340               _locale._cchSrc = 0;
 1341   
 1342               return null;
 1343           }
 1344   
 1345           return getCharsHelper( pos, cch );
 1346       }
 1347   
 1348       // Assumes that there are chars to return, does not assume normal x/p
 1349   
 1350       Object getCharsHelper ( int pos, int cch )
 1351       {
 1352           assert cch > 0 && cchRight( pos ) >= cch;
 1353   
 1354           int pa = posAfter();
 1355   
 1356           Object src;
 1357   
 1358           if (pos >= pa)
 1359           {
 1360               src = _srcAfter;
 1361               _locale._offSrc = _offAfter + pos - pa;
 1362           }
 1363           else
 1364           {
 1365               src = _srcValue;
 1366               _locale._offSrc = _offValue + pos - 1;
 1367           }
 1368   
 1369           _locale._cchSrc = cch;
 1370   
 1371           return src;
 1372       }
 1373   
 1374       //
 1375       //
 1376       //
 1377   
 1378       final void setBit     ( int mask ) { _bits |=  mask; }
 1379       final void clearBit   ( int mask ) { _bits &= ~mask; }
 1380   
 1381       final boolean bitIsSet   ( int mask ) { return (_bits & mask) != 0; }
 1382       final boolean bitIsClear ( int mask ) { return (_bits & mask) == 0; }
 1383   
 1384       static final int VACANT             = 0x100;
 1385       static final int STABLE_USER        = 0x200;
 1386       static final int INHIBIT_DISCONNECT = 0x400;
 1387   
 1388       final boolean isVacant          ( ) { return bitIsSet   ( VACANT ); }
 1389       final boolean isOccupied        ( ) { return bitIsClear ( VACANT ); }
 1390       final boolean inhibitDisconnect ( ) { return bitIsSet   ( INHIBIT_DISCONNECT ); }
 1391   
 1392       final boolean isStableUser    ( ) { return bitIsSet( STABLE_USER ); }
 1393   
 1394       void invalidateNil ( )
 1395       {
 1396           if (_user != null)
 1397               _user.invalidate_nilvalue();
 1398       }
 1399   
 1400       void setStableType ( SchemaType type )
 1401       {
 1402           setStableUser( ((TypeStoreUserFactory) type).createTypeStoreUser() );
 1403       }
 1404   
 1405       void setStableUser ( TypeStoreUser user )
 1406       {
 1407           disconnectNonRootUsers();
 1408           disconnectUser();
 1409   
 1410           assert _user == null;
 1411   
 1412           _user = user;
 1413   
 1414           _user.attach_store( this );
 1415   
 1416           setBit( STABLE_USER );
 1417       }
 1418   
 1419       void disconnectUser ( )
 1420       {
 1421           if (_user != null && !inhibitDisconnect())
 1422           {
 1423               ensureOccupancy();
 1424               _user.disconnect_store();
 1425               _user = null;
 1426           }
 1427       }
 1428   
 1429       // If a node does not have a user, then I don't need to walk its descendents.  NOte that
 1430       // the doconnect happens in document order.  This may be a problem ... not sure ... May want
 1431       // to disconnect in a bottom up manner.
 1432   
 1433       void disconnectNonRootUsers ( )
 1434       {
 1435           Xobj next;
 1436   
 1437           for ( Xobj x = this ; x != null ; x = next )
 1438           {
 1439               next = x.walk( this, x._user != null );
 1440   
 1441               if (!x.isRoot())
 1442                   x.disconnectUser();
 1443           }
 1444       }
 1445   
 1446       void disconnectChildrenUsers ( )
 1447       {
 1448           Xobj next;
 1449   
 1450           for ( Xobj x = walk( this, _user == null ) ; x != null ; x = next )
 1451           {
 1452               next = x.walk( this, x._user != null );
 1453   
 1454               x.disconnectUser();
 1455           }
 1456       }
 1457   
 1458       /**
 1459        * Given a prefix, returns the namespace corresponding to
 1460        * the prefix at this location, or null if there is no mapping
 1461        * for this prefix.
 1462        * <p>
 1463        * prefix="" indicates the absence of a prefix.  A return value
 1464        * of "" indicates the no-namespace, and should not be confused
 1465        * with a return value of null, which indicates an illegal
 1466        * state, where there is no mapping for the given prefix.
 1467        * <p>
 1468        * If the the default namespace is not explicitly mapped in the xml,
 1469        * the xml spec says that it should be mapped to the no-namespace.
 1470        * When the 'defaultAlwaysMapped' parameter is true, the default namepsace
 1471        * will return the no-namespace even if it is not explicity
 1472        * mapped, otherwise the default namespace will return null.
 1473        * <p>
 1474        * This function intercepts the built-in prefixes "xml" and
 1475        * "xmlns" and returns their well-known namespace URIs.
 1476        *
 1477        * @param prefix The prefix to look up.
 1478        * @param defaultAlwaysMapped If true, return the no-namespace for the default namespace if not set.
 1479        * @return The mapped namespace URI ("" if no-namespace), or null if no mapping.
 1480        */
 1481   
 1482       final String namespaceForPrefix ( String prefix, boolean defaultAlwaysMapped )
 1483       {
 1484           if (prefix == null)
 1485               prefix = "";
 1486   
 1487           // handle built-in prefixes
 1488   
 1489           if (prefix.equals( "xml" ))
 1490               return Locale._xml1998Uri;
 1491   
 1492           if (prefix.equals( "xmlns" ))
 1493               return Locale._xmlnsUri;
 1494   
 1495           for ( Xobj x = this ; x != null ; x = x._parent )
 1496               for ( Xobj a = x._firstChild ; a != null && a.isAttr() ; a = a._nextSibling )
 1497                   if (a.isXmlns() && a.getXmlnsPrefix().equals( prefix ))
 1498                       return a.getXmlnsUri();
 1499   
 1500           return defaultAlwaysMapped && prefix.length() == 0 ? "" : null;
 1501       }
 1502   
 1503       final String prefixForNamespace ( String ns, String suggestion, boolean createIfMissing )
 1504       {
 1505           if (ns == null)
 1506               ns = "";
 1507   
 1508           // special cases
 1509   
 1510           if (ns.equals( Locale._xml1998Uri ))
 1511               return "xml";
 1512   
 1513           if (ns.equals( Locale._xmlnsUri ))
 1514               return "xmlns";
 1515   
 1516           // Get the closest container for the spot we're on
 1517   
 1518           Xobj base = this;
 1519   
 1520           while ( !base.isContainer() )
 1521               base = base.ensureParent();
 1522   
 1523           // Special handling for the no-namespace case
 1524   
 1525           if (ns.length() == 0)
 1526           {
 1527               // Search for a namespace decl which defines the default namespace
 1528   
 1529               Xobj a = base.findXmlnsForPrefix( "" );
 1530   
 1531               // If I did not find a default decl or the decl maps to the no namespace, then
 1532               // the default namespace is mapped to ""
 1533   
 1534               if (a == null || a.getXmlnsUri().length() == 0)
 1535                   return "";
 1536   
 1537               // At this point, I've found a default namespace which is *not* the no-namespace.
 1538               // If I can't modify the document to mape the desired no-namespace, I must fail.
 1539   
 1540               if (!createIfMissing)
 1541                   return null;
 1542   
 1543               // Ok, I need to make the default namespace on the nearest container map to ""
 1544   
 1545               base.setAttr( _locale.createXmlns( null ), "" );
 1546   
 1547               return "";
 1548           }
 1549   
 1550           // Look for an exisiting mapping for the desired uri which has a visible prefix
 1551   
 1552           for ( Xobj c = base ; c != null ; c = c._parent )
 1553               for ( Xobj a = c.firstAttr() ; a != null ; a = a.nextAttr() )
 1554                   if (a.isXmlns() && a.getXmlnsUri().equals( ns ))
 1555                       if (base.findXmlnsForPrefix( a.getXmlnsPrefix() ) == a)
 1556                           return a.getXmlnsPrefix();
 1557   
 1558           // No exisiting xmlns I can use, need to create one.  See if I can first
 1559   
 1560           if (!createIfMissing)
 1561               return null;
 1562   
 1563           // Sanitize the suggestion.
 1564   
 1565           if (suggestion != null &&
 1566                 (suggestion.length() == 0 || suggestion.toLowerCase().startsWith( "xml" ) ||
 1567                       base.findXmlnsForPrefix( suggestion ) != null))
 1568           {
 1569               suggestion = null;
 1570           }
 1571   
 1572           // If no suggestion, make one up
 1573   
 1574           if (suggestion == null)
 1575           {
 1576               String prefixBase = QNameHelper.suggestPrefix( ns );
 1577   
 1578               suggestion = prefixBase;
 1579   
 1580               for ( int i = 1 ; ; suggestion = prefixBase + i++ )
 1581                   if (base.findXmlnsForPrefix( suggestion ) == null)
 1582                       break;
 1583           }
 1584   
 1585           // Add a new namespace decl at the top elem if one exists, otherwise at root
 1586   
 1587           Xobj c = base;
 1588   
 1589           while ( !c.isRoot() && !c.ensureParent().isRoot() )
 1590               c = c._parent;
 1591   
 1592           base.setAttr( _locale.createXmlns( suggestion ), ns );
 1593   
 1594           return suggestion;
 1595       }
 1596   
 1597       final QName getValueAsQName ( )
 1598       {
 1599           assert !hasChildren();
 1600   
 1601           // TODO -
 1602           // caching the QName value in this object would prevent one from having
 1603           // to repeat all this string arithmatic over and over again.  Perhaps
 1604           // when I make the store capable of handling strong simple types this
 1605           // can be done ...
 1606   
 1607           String value = getValueAsString( Locale.WS_COLLAPSE );
 1608   
 1609           String prefix, localname;
 1610   
 1611           int firstcolon = value.indexOf( ':' );
 1612   
 1613           if (firstcolon >= 0)
 1614           {
 1615               prefix = value.substring( 0, firstcolon );
 1616               localname = value.substring( firstcolon + 1 );
 1617           }
 1618           else
 1619           {
 1620               prefix = "";
 1621               localname = value;
 1622           }
 1623   
 1624           String uri = namespaceForPrefix( prefix, true );
 1625   
 1626           if (uri == null)
 1627               return null; // no prefix definition found - that's illegal
 1628   
 1629           return new QName( uri, localname );
 1630       }
 1631   
 1632       final Xobj getAttr ( QName name )
 1633       {
 1634           for ( Xobj x = _firstChild ; x != null && x.isAttr() ; x = x._nextSibling )
 1635               if (x._name.equals( name ))
 1636                   return x;
 1637   
 1638           return null;
 1639       }
 1640   
 1641       final QName getXsiTypeName ( )
 1642       {
 1643           assert isContainer();
 1644   
 1645           Xobj a = getAttr( Locale._xsiType );
 1646   
 1647           return a == null ? null : a.getValueAsQName();
 1648       }
 1649   
 1650       final XmlObject getObject ( )
 1651       {
 1652           return isUserNode() ?  (XmlObject) getUser() : null;
 1653       }
 1654   
 1655       final TypeStoreUser getUser ( )
 1656       {
 1657           assert isUserNode();
 1658           assert _user != null || (!isRoot() && !isStableUser());
 1659   
 1660           if (_user == null)
 1661           {
 1662               // BUGBUG - this is recursive
 1663   
 1664               TypeStoreUser parentUser =
 1665                   _parent == null
 1666                       ? ((TypeStoreUserFactory) XmlBeans.NO_TYPE).createTypeStoreUser()
 1667                       : _parent.getUser();
 1668   
 1669               _user =
 1670                   isElem()
 1671                       ? parentUser.create_element_user( _name, getXsiTypeName() )
 1672                       : parentUser.create_attribute_user( _name );
 1673   
 1674               _user.attach_store( this );
 1675           }
 1676   
 1677           return _user;
 1678       }
 1679   
 1680       final void invalidateUser ( )
 1681       {
 1682           assert isValid();
 1683           assert _user == null || isUserNode();
 1684   
 1685           if (_user != null)
 1686               _user.invalidate_value();
 1687       }
 1688   
 1689       final void ensureOccupancy ( )
 1690       {
 1691           assert isValid();
 1692   
 1693           if (isVacant())
 1694           {
 1695               assert isUserNode();
 1696   
 1697               // In order to use Cur to set the value, I mark the
 1698               // value as occupied and remove the user to prohibit
 1699               // further user invalidations
 1700   
 1701               clearBit( VACANT );
 1702   
 1703               TypeStoreUser user = _user;
 1704               _user = null;
 1705   
 1706               String value = user.build_text( this );
 1707   
 1708   
 1709               long saveVersion = _locale._versionAll;
 1710               long saveVersionSansText = _locale._versionSansText;
 1711   
 1712   
 1713               setValue( value );
 1714               assert saveVersionSansText == _locale._versionSansText;
 1715   
 1716               _locale._versionAll = saveVersion;
 1717   
 1718   
 1719               assert _user == null;
 1720               _user = user;
 1721           }
 1722       }
 1723       private void setValue(String val)
 1724       {
 1725           assert CharUtil.isValid(val, 0, val.length());
 1726   
 1727           // Check for nothing to insert
 1728   
 1729           if (val.length() <= 0)
 1730               return;
 1731   
 1732           _locale.notifyChange();
 1733           Xobj lastAttr = lastAttr();
 1734           int startPos = 1;
 1735           Xobj charOwner = this;
 1736           if (lastAttr != null)
 1737           {
 1738               charOwner = lastAttr;
 1739               startPos = charOwner.posAfter();
 1740           }
 1741           charOwner.insertCharsHelper(startPos, val, 0, val.length(), true);
 1742       }
 1743       //
 1744       // TypeStore
 1745       //
 1746   
 1747       public SchemaTypeLoader get_schematypeloader ( )
 1748       {
 1749           return _locale._schemaTypeLoader;
 1750       }
 1751   
 1752       public XmlLocale get_locale ( )
 1753       {
 1754           return _locale;
 1755       }
 1756   
 1757       // TODO - remove this when I've replaced the old store
 1758       public Object get_root_object ( )
 1759       {
 1760           return _locale;
 1761       }
 1762   
 1763       public boolean is_attribute    ( ) { assert isValid(); return isAttr();               }
 1764       public boolean validate_on_set ( ) { assert isValid(); return _locale._validateOnSet; }
 1765   
 1766       public void invalidate_text ( )
 1767       {
 1768           _locale.enter();
 1769   
 1770           try
 1771           {
 1772               assert isValid();
 1773   
 1774               if (isOccupied())
 1775               {
 1776                   if (hasTextNoEnsureOccupancy() || hasChildren())
 1777                   {
 1778                       TypeStoreUser user = _user;
 1779                       _user = null;
 1780   
 1781                       Cur c = tempCur();
 1782                       c.moveNodeContents( null, false );
 1783                       c.release();
 1784   
 1785                       assert _user == null;
 1786                       _user = user;
 1787                   }
 1788   
 1789                   setBit( VACANT );
 1790               }
 1791   
 1792               assert isValid();
 1793           }
 1794           finally
 1795           {
 1796               _locale.exit();
 1797           }
 1798       }
 1799   
 1800       public String fetch_text ( int wsr )
 1801       {
 1802           _locale.enter();
 1803   
 1804           try
 1805           {
 1806               assert isValid() && isOccupied();
 1807   
 1808               return getValueAsString( wsr );
 1809           }
 1810           finally
 1811           {
 1812               _locale.exit();
 1813           }
 1814       }
 1815   
 1816       public XmlCursor new_cursor ( )
 1817       {
 1818           _locale.enter();
 1819   
 1820           try
 1821           {
 1822               Cur c = tempCur();
 1823               XmlCursor xc = new Cursor( c );
 1824               c.release();
 1825               return xc;
 1826   
 1827           }
 1828           finally
 1829           {
 1830               _locale.exit();
 1831           }
 1832       }
 1833   
 1834       public SchemaField get_schema_field ( )
 1835       {
 1836           assert isValid();
 1837   
 1838           if (isRoot())
 1839               return null;
 1840   
 1841           TypeStoreUser parentUser = ensureParent().getUser();
 1842   
 1843           if (isAttr())
 1844               return parentUser.get_attribute_field( _name );
 1845   
 1846           assert isElem();
 1847   
 1848           TypeStoreVisitor visitor = parentUser.new_visitor();
 1849   
 1850           if (visitor == null)
 1851               return null;
 1852   
 1853           for ( Xobj x = _parent._firstChild ; ; x = x._nextSibling )
 1854           {
 1855               if (x.isElem())
 1856               {
 1857                   visitor.visit( x._name );
 1858   
 1859                   if (x == this)
 1860                       return visitor.get_schema_field();
 1861               }
 1862           }
 1863       }
 1864   
 1865       public void validate ( ValidatorListener eventSink )
 1866       {
 1867           _locale.enter();
 1868   
 1869           try
 1870           {
 1871               Cur c = tempCur();
 1872               Validate validate = new Validate( c, eventSink );
 1873               c.release();
 1874           }
 1875           finally
 1876           {
 1877               _locale.exit();
 1878           }
 1879       }
 1880   
 1881       public TypeStoreUser change_type ( SchemaType type )
 1882       {
 1883           _locale.enter();
 1884   
 1885           try
 1886           {
 1887               Cur c = tempCur();
 1888               c.setType( type, false );
 1889               c.release();
 1890           }
 1891           finally
 1892           {
 1893               _locale.exit();
 1894           }
 1895   
 1896           return getUser();
 1897       }
 1898   
 1899       public TypeStoreUser substitute ( QName name, SchemaType type )
 1900       {
 1901           _locale.enter();
 1902   
 1903           try
 1904           {
 1905               Cur c = tempCur();
 1906               c.setSubstitution( name, type, false );
 1907               c.release();
 1908           }
 1909           finally
 1910           {
 1911               _locale.exit();
 1912           }
 1913   
 1914           return getUser();
 1915       }
 1916   
 1917       public QName get_xsi_type ( )
 1918       {
 1919           return getXsiTypeName();
 1920       }
 1921   
 1922       public void store_text ( String text )
 1923       {
 1924           _locale.enter();
 1925   
 1926           TypeStoreUser user = _user;
 1927           _user = null;
 1928   
 1929           try
 1930           {
 1931               Cur c = tempCur();
 1932   
 1933               c.moveNodeContents( null, false );
 1934   
 1935               if (text != null && text.length() > 0)
 1936               {
 1937                   c.next();
 1938                   c.insertString( text );
 1939               }
 1940   
 1941               c.release();
 1942           }
 1943           finally
 1944           {
 1945               assert _user == null;
 1946               _user = user;
 1947   
 1948               _locale.exit();
 1949           }
 1950       }
 1951   
 1952       public int compute_flags ( )
 1953       {
 1954           if (isRoot())
 1955               return 0;
 1956   
 1957           TypeStoreUser parentUser = ensureParent().getUser();
 1958   
 1959           if (isAttr())
 1960               return parentUser.get_attributeflags( _name );
 1961   
 1962           int f = parentUser.get_elementflags( _name );
 1963   
 1964           if (f != -1)
 1965               return f;
 1966   
 1967           TypeStoreVisitor visitor = parentUser.new_visitor();
 1968   
 1969           if (visitor == null)
 1970               return 0;
 1971   
 1972           for ( Xobj x = _parent._firstChild ; ; x = x._nextSibling )
 1973           {
 1974               if (x.isElem())
 1975               {
 1976                   visitor.visit( x._name );
 1977   
 1978                   if (x == this)
 1979                       return visitor.get_elementflags();
 1980               }
 1981           }
 1982       }
 1983   
 1984       public String compute_default_text ( )
 1985       {
 1986           if (isRoot())
 1987               return null;
 1988   
 1989           TypeStoreUser parentUser = ensureParent().getUser();
 1990   
 1991           if (isAttr())
 1992               return parentUser.get_default_attribute_text( _name );
 1993   
 1994           String result = parentUser.get_default_element_text( _name );
 1995   
 1996           if (result != null)
 1997               return result;
 1998   
 1999           TypeStoreVisitor visitor = parentUser.new_visitor();
 2000   
 2001           if (visitor == null)
 2002               return null;
 2003   
 2004           for ( Xobj x = _parent._firstChild ; ; x = x._nextSibling )
 2005           {
 2006               if (x.isElem())
 2007               {
 2008                   visitor.visit( x._name );
 2009   
 2010                   if (x == this)
 2011                       return visitor.get_default_text();
 2012               }
 2013           }
 2014       }
 2015   
 2016       public boolean find_nil ( )
 2017       {
 2018           if (isAttr())
 2019               return false;
 2020   
 2021           _locale.enter();
 2022   
 2023           try
 2024           {
 2025               Xobj a = getAttr( Locale._xsiNil );
 2026   
 2027               if (a == null)
 2028                   return false;
 2029   
 2030               String value = a.getValueAsString( Locale.WS_COLLAPSE );
 2031   
 2032               return value.equals( "true" ) || value.equals( "1" );
 2033           }
 2034           finally
 2035           {
 2036               _locale.exit();
 2037           }
 2038       }
 2039   
 2040       public void invalidate_nil ( )
 2041       {
 2042           if (isAttr())
 2043               return;
 2044   
 2045           _locale.enter();
 2046   
 2047           try
 2048           {
 2049               if (!_user.build_nil())
 2050                   removeAttr( Locale._xsiNil );
 2051               else
 2052                   setAttr( Locale._xsiNil, "true" );
 2053           }
 2054           finally
 2055           {
 2056               _locale.exit();
 2057           }
 2058       }
 2059   
 2060       public int count_elements ( QName name )
 2061       {
 2062           return _locale.count( this, name, null );
 2063       }
 2064   
 2065       public int count_elements ( QNameSet names )
 2066       {
 2067           return _locale.count( this, null, names );
 2068       }
 2069   
 2070       public TypeStoreUser find_element_user ( QName name, int i )
 2071       {
 2072           for ( Xobj x = _firstChild ; x != null ; x = x._nextSibling )
 2073               if (x.isElem() && x._name.equals( name ) && --i < 0)
 2074                   return x.getUser();
 2075   
 2076           return null;
 2077       }
 2078   
 2079       public TypeStoreUser find_element_user ( QNameSet names, int i )
 2080       {
 2081           for ( Xobj x = _firstChild ; x != null ; x = x._nextSibling )
 2082               if (x.isElem() && names.contains( x._name ) && --i < 0)
 2083                   return x.getUser();
 2084   
 2085           return null;
 2086       }
 2087   
 2088       public void find_all_element_users ( QName name, List fillMeUp )
 2089       {
 2090           for ( Xobj x = _firstChild ; x != null ; x = x._nextSibling )
 2091               if (x.isElem() && x._name.equals( name ))
 2092                   fillMeUp.add( x.getUser() );
 2093       }
 2094   
 2095       public void find_all_element_users ( QNameSet names, List fillMeUp )
 2096       {
 2097           for ( Xobj x = _firstChild ; x != null ; x = x._nextSibling )
 2098               if (x.isElem() && names.contains( x._name ))
 2099                   fillMeUp.add( x.getUser() );
 2100       }
 2101   
 2102       private static TypeStoreUser insertElement ( QName name, Xobj x, int pos )
 2103       {
 2104           x._locale.enter();
 2105   
 2106           try
 2107           {
 2108               Cur c = x._locale.tempCur();
 2109               c.moveTo( x, pos );
 2110               c.createElement( name );
 2111               TypeStoreUser user = c.getUser();
 2112               c.release();
 2113               return user;
 2114           }
 2115           finally
 2116           {
 2117               x._locale.exit();
 2118           }
 2119       }
 2120   
 2121       public TypeStoreUser insert_element_user ( QName name, int i )
 2122       {
 2123           if (i < 0)
 2124               throw new IndexOutOfBoundsException();
 2125   
 2126           if (!isContainer())
 2127               throw new IllegalStateException();
 2128   
 2129           Xobj x = _locale.findNthChildElem( this, name, null, i );
 2130   
 2131           if (x == null)
 2132           {
 2133               if (i > _locale.count( this, name, null ) + 1)
 2134                   throw new IndexOutOfBoundsException();
 2135   
 2136               return add_element_user( name );
 2137           }
 2138   
 2139           return insertElement( name, x, 0 );
 2140       }
 2141   
 2142       public TypeStoreUser insert_element_user ( QNameSet names, QName name, int i )
 2143       {
 2144           if (i < 0)
 2145               throw new IndexOutOfBoundsException();
 2146   
 2147           if (!isContainer())
 2148               throw new IllegalStateException();
 2149   
 2150           Xobj x = _locale.findNthChildElem( this, null, names, i );
 2151   
 2152           if (x == null)
 2153           {
 2154               if (i > _locale.count( this, null, names ) + 1)
 2155                   throw new IndexOutOfBoundsException();
 2156   
 2157               return add_element_user( name );
 2158           }
 2159   
 2160           return insertElement( name, x, 0 );
 2161       }
 2162   
 2163       public TypeStoreUser add_element_user ( QName name )
 2164       {
 2165           if (!isContainer())
 2166               throw new IllegalStateException();
 2167   
 2168           QNameSet endSet = null;
 2169           boolean  gotEndSet = false;
 2170   
 2171           Xobj candidate = null;
 2172   
 2173           for ( Xobj x = _lastChild ; x != null ; x = x._prevSibling )
 2174           {
 2175               if (x.isContainer())
 2176               {
 2177                   if (x._name.equals( name ))
 2178                       break;
 2179   
 2180                   if (!gotEndSet)
 2181                   {
 2182                       endSet = _user.get_element_ending_delimiters( name );
 2183                       gotEndSet = true;
 2184                   }
 2185   
 2186                   if (endSet == null || endSet.contains( x._name ))
 2187                       candidate = x;
 2188               }
 2189           }
 2190   
 2191           return
 2192               candidate == null
 2193                   ? insertElement( name, this, END_POS )
 2194                   : insertElement( name, candidate, 0 );
 2195       }
 2196   
 2197       private static void removeElement ( Xobj x )
 2198       {
 2199           if (x == null)
 2200               throw new IndexOutOfBoundsException();
 2201   
 2202           x._locale.enter();
 2203   
 2204           try
 2205           {
 2206               Cur c = x.tempCur();
 2207               c.moveNode( null );
 2208               c.release();
 2209           }
 2210           finally
 2211           {
 2212               x._locale.exit();
 2213           }
 2214       }
 2215   
 2216       public void remove_element ( QName name, int i )
 2217       {
 2218           if (i < 0)
 2219               throw new IndexOutOfBoundsException();
 2220   
 2221           if (!isContainer())
 2222               throw new IllegalStateException();
 2223   
 2224           Xobj x;
 2225   
 2226           for ( x = _firstChild ; x != null ; x = x._nextSibling )
 2227               if (x.isElem() && x._name.equals( name ) && --i < 0)
 2228                   break;
 2229   
 2230           removeElement( x );
 2231       }
 2232   
 2233       public void remove_element ( QNameSet names, int i )
 2234       {
 2235           if (i < 0)
 2236               throw new IndexOutOfBoundsException();
 2237   
 2238           if (!isContainer())
 2239               throw new IllegalStateException();
 2240   
 2241           Xobj x;
 2242   
 2243           for ( x = _firstChild ; x != null ; x = x._nextSibling )
 2244               if (x.isElem() && names.contains( x._name ) && --i < 0)
 2245                   break;
 2246   
 2247           removeElement( x );
 2248       }
 2249   
 2250       public TypeStoreUser find_attribute_user ( QName name )
 2251       {
 2252           Xobj a = getAttr( name );
 2253   
 2254           return a == null ? null : a.getUser();
 2255       }
 2256   
 2257       public TypeStoreUser add_attribute_user ( QName name )
 2258       {
 2259           if (getAttr( name ) != null)
 2260               throw new IndexOutOfBoundsException();
 2261   
 2262           _locale.enter();
 2263   
 2264           try
 2265           {
 2266               return setAttr( name, "" ).getUser();
 2267           }
 2268           finally
 2269           {
 2270               _locale.exit();
 2271           }
 2272       }
 2273   
 2274       public void remove_attribute ( QName name )
 2275       {
 2276           _locale.enter();
 2277   
 2278           try
 2279           {
 2280               if (!removeAttr( name ))
 2281                   throw new IndexOutOfBoundsException();
 2282           }
 2283           finally
 2284           {
 2285               _locale.exit();
 2286           }
 2287       }
 2288   
 2289       public TypeStoreUser copy_contents_from ( TypeStore source )
 2290       {
 2291           Xobj xSrc = (Xobj) source;
 2292   
 2293           if (xSrc == this)
 2294               return getUser();
 2295   
 2296           _locale.enter();
 2297   
 2298           try
 2299           {
 2300               xSrc._locale.enter();
 2301   
 2302               Cur c = tempCur();
 2303   
 2304               try
 2305               {
 2306                   Cur cSrc1 = xSrc.tempCur();
 2307                   Map sourceNamespaces = Locale.getAllNamespaces( cSrc1, null );
 2308                   cSrc1.release();
 2309   
 2310                   if (isAttr())
 2311                   {
 2312                       Cur cSrc = xSrc.tempCur();
 2313                       String value = Locale.getTextValue( cSrc );
 2314                       cSrc.release();
 2315   
 2316                       c.setValue( value );
 2317                   }
 2318                   else
 2319                   {
 2320                       // Here I save away the user of this node so that it does not get whacked
 2321                       // in the following operations.
 2322   
 2323                       disconnectChildrenUsers();
 2324   
 2325                       assert !inhibitDisconnect();
 2326   
 2327                       setBit( INHIBIT_DISCONNECT );
 2328   
 2329                       QName xsiType = isContainer() ? getXsiTypeName() : null;
 2330   
 2331                       Xobj copy = xSrc.copyNode( _locale );
 2332   
 2333                       Cur.moveNodeContents( this, null, true );
 2334   
 2335                       c.next();
 2336   
 2337                       Cur.moveNodeContents( copy, c, true );
 2338   
 2339                       c.moveTo( this );
 2340   
 2341                       if (xsiType != null)
 2342                           c.setXsiType( xsiType );
 2343   
 2344                       assert inhibitDisconnect();
 2345                       clearBit( INHIBIT_DISCONNECT );
 2346                   }
 2347   
 2348                   if (sourceNamespaces != null)
 2349                   {
 2350                       if (!c.isContainer())
 2351                           c.toParent();
 2352   
 2353                       Locale.applyNamespaces( c, sourceNamespaces );
 2354                   }
 2355   
 2356               }
 2357               finally
 2358               {
 2359                   c.release();
 2360   
 2361                   xSrc._locale.exit();
 2362               }
 2363           }
 2364           finally
 2365           {
 2366               _locale.exit();
 2367           }
 2368   
 2369           return getUser();
 2370       }
 2371   
 2372       public TypeStoreUser copy(SchemaTypeLoader stl, SchemaType type, XmlOptions options)
 2373       {
 2374           //do not use a user's Factory method for copying.
 2375           //XmlFactoryHook hook = XmlFactoryHook.ThreadContext.getHook();
 2376           Xobj destination = null;
 2377           options = XmlOptions.maskNull(options);
 2378           SchemaType sType = (SchemaType) options.get(XmlOptions.DOCUMENT_TYPE);
 2379   
 2380           if (sType == null)
 2381               sType = type == null ? XmlObject.type : type;
 2382   
 2383           Locale locale = this.locale();
 2384           if ( Boolean.TRUE.equals(options.get(Locale.COPY_USE_NEW_LOCALE)) )
 2385               locale = Locale.getLocale(stl, options);
 2386   
 2387           if (sType.isDocumentType() || (sType.isNoType() && (this instanceof Xobj.DocumentXobj)))
 2388               destination = Cur.createDomDocumentRootXobj(this.locale(), false);
 2389           else
 2390               destination = Cur.createDomDocumentRootXobj(this.locale(), true);
 2391   
 2392   
 2393           _locale.enter();
 2394           try
 2395           {
 2396               Cur c = destination.tempCur();
 2397               c.setType(type);
 2398               c.release();
 2399           }
 2400           finally
 2401           {
 2402               _locale.exit();
 2403           }
 2404   
 2405           TypeStoreUser tsu = destination.copy_contents_from(this);
 2406           return tsu;
 2407       }
 2408   
 2409       public void array_setter ( XmlObject[] sources, QName elementName )
 2410       {
 2411           _locale.enter();
 2412   
 2413           try
 2414           {
 2415               // TODO - this is the quick and dirty implementation, make this faster
 2416   
 2417               int m = sources.length;
 2418   
 2419               ArrayList copies = new ArrayList();
 2420               ArrayList types = new ArrayList();
 2421   
 2422               for ( int i = 0 ; i < m ; i++ )
 2423               {
 2424       // TODO - deal with null sources[ i ] here -- what to do?
 2425   
 2426                   if (sources[ i ] == null)
 2427                       throw new IllegalArgumentException( "Array element null" );
 2428   
 2429                   else if (sources[ i ].isImmutable())
 2430                   {
 2431                       copies.add( null );
 2432                       types.add( null );
 2433                   }
 2434                   else
 2435                   {
 2436                       Xobj x = ((Xobj) ((TypeStoreUser) sources[ i ]).get_store());
 2437   
 2438                       if (x._locale == _locale)
 2439                           copies.add( x.copyNode( _locale ) );
 2440                       else
 2441                       {
 2442                           x._locale.enter();
 2443   
 2444                           try
 2445                           {
 2446                               copies.add( x.copyNode( _locale ) );
 2447                           }
 2448                           finally
 2449                           {
 2450                               x._locale.exit();
 2451                           }
 2452                       }
 2453   
 2454                       types.add( sources[ i ].schemaType() );
 2455                   }
 2456               }
 2457   
 2458               int n = count_elements( elementName );
 2459   
 2460               for ( ; n > m ; n-- )
 2461                   remove_element( elementName, m );
 2462   
 2463               for ( ; m > n ; n++ )
 2464                   add_element_user( elementName );
 2465   
 2466               assert m == n;
 2467   
 2468               ArrayList elements = new ArrayList();
 2469   
 2470               find_all_element_users( elementName, elements );
 2471   
 2472               for ( int i = 0 ; i < elements.size() ; i++ )
 2473                   elements.set( i, (Xobj) ((TypeStoreUser) elements.get( i )).get_store() );
 2474   
 2475               assert elements.size() == n;
 2476   
 2477               Cur c = tempCur();
 2478   
 2479               for ( int i = 0 ; i < n ; i++ )
 2480               {
 2481                   Xobj x = (Xobj) elements.get( i );
 2482   
 2483                   if (sources[ i ].isImmutable())
 2484                       x.getObject().set( sources[ i ] );
 2485                   else
 2486                   {
 2487                       Cur.moveNodeContents( x, null, true );
 2488   
 2489                       c.moveTo( x );
 2490                       c.next();
 2491   
 2492                       Cur.moveNodeContents( (Xobj) copies.get( i ), c, true );
 2493   
 2494                       x.change_type( (SchemaType) types.get( i ) );
 2495                   }
 2496               }
 2497   
 2498               c.release();
 2499           }
 2500           finally
 2501           {
 2502               _locale.exit();
 2503           }
 2504       }
 2505   
 2506       public void visit_elements ( TypeStoreVisitor visitor )
 2507       {
 2508           throw new RuntimeException( "Not implemeneted" );
 2509       }
 2510   
 2511       public XmlObject[] exec_query ( String queryExpr, XmlOptions options ) throws XmlException
 2512       {
 2513           _locale.enter();
 2514   
 2515           try
 2516           {
 2517               Cur c = tempCur();
 2518   
 2519               XmlObject[] result = Query.objectExecQuery( c, queryExpr, options );
 2520   
 2521               c.release();
 2522   
 2523               return result;
 2524           }
 2525           finally
 2526           {
 2527               _locale.exit();
 2528           }
 2529       }
 2530   
 2531       public String find_prefix_for_nsuri ( String nsuri, String suggested_prefix )
 2532       {
 2533           _locale.enter();
 2534   
 2535           try
 2536           {
 2537               return prefixForNamespace( nsuri, suggested_prefix, true );
 2538           }
 2539           finally
 2540           {
 2541               _locale.exit();
 2542           }
 2543       }
 2544   
 2545       public String getNamespaceForPrefix ( String prefix )
 2546       {
 2547           return namespaceForPrefix( prefix, true );
 2548       }
 2549   
 2550       //
 2551       //
 2552       //
 2553   
 2554       abstract static class NodeXobj extends Xobj implements Dom, Node, NodeList
 2555       {
 2556           NodeXobj ( Locale l, int kind, int domType )
 2557           {
 2558               super( l, kind, domType );
 2559           }
 2560   
 2561           Dom getDom ( ) { return this; }
 2562   
 2563           //
 2564           //
 2565           //
 2566   
 2567           public int getLength ( ) { return DomImpl._childNodes_getLength( this ); }
 2568           public Node item ( int i ) { return DomImpl._childNodes_item( this, i ); }
 2569   
 2570           public Node appendChild ( Node newChild ) { return DomImpl._node_appendChild( this, newChild ); }
 2571           public Node cloneNode ( boolean deep ) { return DomImpl._node_cloneNode( this, deep ); }
 2572           public NamedNodeMap getAttributes ( ) { return null; }
 2573           public NodeList getChildNodes ( ) { return this; }
 2574           public Node getParentNode ( ) { return DomImpl._node_getParentNode( this ); }
 2575           public Node removeChild ( Node oldChild ) { return DomImpl._node_removeChild( this, oldChild ); }
 2576           public Node getFirstChild ( ) { return DomImpl._node_getFirstChild( this ); }
 2577           public Node getLastChild ( ) { return DomImpl._node_getLastChild( this ); }
 2578           public String getLocalName ( ) { return DomImpl._node_getLocalName( this ); }
 2579           public String getNamespaceURI ( ) { return DomImpl._node_getNamespaceURI( this ); }
 2580           public Node getNextSibling ( ) { return DomImpl._node_getNextSibling( this ); }
 2581           public String getNodeName ( ) { return DomImpl._node_getNodeName( this ); }
 2582           public short getNodeType ( ) { return DomImpl._node_getNodeType( this ); }
 2583           public String getNodeValue ( ) { return DomImpl._node_getNodeValue( this ); }
 2584           public Document getOwnerDocument ( ) { return DomImpl._node_getOwnerDocument( this ); }
 2585           public String getPrefix ( ) { return DomImpl._node_getPrefix( this ); }
 2586           public Node getPreviousSibling ( ) { return DomImpl._node_getPreviousSibling( this ); }
 2587           public boolean hasAttributes ( ) { return DomImpl._node_hasAttributes( this ); }
 2588           public boolean hasChildNodes ( ) { return DomImpl._node_hasChildNodes( this ); }
 2589           public Node insertBefore ( Node newChild, Node refChild ) { return DomImpl._node_insertBefore( this, newChild, refChild ); }
 2590           public boolean isSupported ( String feature, String version ) { return DomImpl._node_isSupported( this, feature, version ); }
 2591           public void normalize ( ) { DomImpl._node_normalize( this ); }
 2592           public Node replaceChild ( Node newChild, Node oldChild ) { return DomImpl._node_replaceChild( this, newChild, oldChild ); }
 2593           public void setNodeValue ( String nodeValue ) { DomImpl._node_setNodeValue( this, nodeValue ); }
 2594           public void setPrefix ( String prefix ) { DomImpl._node_setPrefix( this, prefix ); }
 2595           public boolean nodeCanHavePrefixUri( ){ return false; }
 2596   
 2597           // DOM Level 3
 2598           public Object getUserData ( String key ) { return DomImpl._node_getUserData( this, key ); }
 2599           public Object setUserData ( String key, Object data, UserDataHandler handler ) { return DomImpl._node_setUserData( this, key, data, handler ); }
 2600           public Object getFeature ( String feature, String version ) { return DomImpl._node_getFeature( this, feature, version ); }
 2601           public boolean isEqualNode ( Node arg ) { return DomImpl._node_isEqualNode( this, arg ); }
 2602           public boolean isSameNode ( Node arg ) { return DomImpl._node_isSameNode( this, arg ); }
 2603           public String lookupNamespaceURI ( String prefix ) { return DomImpl._node_lookupNamespaceURI( this, prefix ); }
 2604           public String lookupPrefix ( String namespaceURI ) { return DomImpl._node_lookupPrefix( this, namespaceURI ); }
 2605           public boolean isDefaultNamespace ( String namespaceURI ) { return DomImpl._node_isDefaultNamespace( this, namespaceURI ); }
 2606           public void setTextContent ( String textContent ) { DomImpl._node_setTextContent( this, textContent ); }
 2607           public String getTextContent ( ) { return DomImpl._node_getTextContent( this ); }
 2608           public short compareDocumentPosition ( Node other ) { return DomImpl._node_compareDocumentPosition( this, other ); }
 2609           public String getBaseURI ( ) { return DomImpl._node_getBaseURI( this ); }
 2610       }
 2611   
 2612        static class DocumentXobj extends NodeXobj implements Document
 2613       {
 2614           DocumentXobj ( Locale l )
 2615           {
 2616               super( l, ROOT, DomImpl.DOCUMENT );
 2617           }
 2618   
 2619           Xobj newNode ( Locale l ) { return new DocumentXobj( l ); }
 2620   
 2621           //
 2622           //
 2623           //
 2624   
 2625           public Attr createAttribute ( String name ) { return DomImpl._document_createAttribute( this, name ); }
 2626           public Attr createAttributeNS ( String namespaceURI, String qualifiedName ) { return DomImpl._document_createAttributeNS( this, namespaceURI, qualifiedName ); }
 2627           public CDATASection createCDATASection ( String data ) { return DomImpl._document_createCDATASection( this, data ); }
 2628           public Comment createComment ( String data ) { return DomImpl._document_createComment( this, data ); }
 2629           public DocumentFragment createDocumentFragment ( ) { return DomImpl._document_createDocumentFragment( this ); }
 2630           public Element createElement ( String tagName ) { return DomImpl._document_createElement( this, tagName ); }
 2631           public Element createElementNS ( String namespaceURI, String qualifiedName ) { return DomImpl._document_createElementNS( this, namespaceURI, qualifiedName ); }
 2632           public EntityReference createEntityReference ( String name ) { return DomImpl._document_createEntityReference( this, name ); }
 2633           public ProcessingInstruction createProcessingInstruction ( String target, String data ) { return DomImpl._document_createProcessingInstruction( this, target, data ); }
 2634           public Text createTextNode ( String data ) { return DomImpl._document_createTextNode( this, data ); }
 2635           public DocumentType getDoctype ( ) { return DomImpl._document_getDoctype( this ); }
 2636           public Element getDocumentElement ( ) { return DomImpl._document_getDocumentElement( this ); }
 2637           public Element getElementById ( String elementId ) {
 2638               if ( _idToElement == null )return null;
 2639               Xobj o = (Xobj) _idToElement.get(elementId);
 2640               if (o == null) return null;
 2641               if (!isInSameTree(o))
 2642               {
 2643                   _idToElement.remove(elementId);
 2644               }
 2645               return (Element)o;
 2646           }
 2647           public NodeList getElementsByTagName ( String tagname ) { return DomImpl._document_getElementsByTagName( this, tagname ); }
 2648           public NodeList getElementsByTagNameNS ( String namespaceURI, String localName ) { return DomImpl._document_getElementsByTagNameNS( this, namespaceURI, localName ); }
 2649           public DOMImplementation getImplementation ( ) { return DomImpl._document_getImplementation( this ); }
 2650           public Node importNode ( Node importedNode, boolean deep ) { return DomImpl._document_importNode( this, importedNode, deep ); }
 2651   
 2652           // DOM Level 3
 2653           public Node adoptNode ( Node source ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2654           public String getDocumentURI ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2655           public DOMConfiguration getDomConfig ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2656           public String getInputEncoding ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2657           public boolean getStrictErrorChecking ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2658           public String getXmlEncoding ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2659           public boolean getXmlStandalone ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2660           public String getXmlVersion ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2661           public void normalizeDocument ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2662           public Node renameNode ( Node n, String namespaceURI, String qualifiedName ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2663           public void setDocumentURI ( String documentURI ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2664           public void setStrictErrorChecking ( boolean strictErrorChecking ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2665           public void setXmlStandalone ( boolean xmlStandalone ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2666           public void setXmlVersion ( String xmlVersion ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2667   
 2668           protected void addIdElement( String idVal, Dom e){
 2669               if ( _idToElement == null)
 2670                   _idToElement = new java.util.Hashtable();
 2671               _idToElement.put(idVal,e);
 2672           }
 2673            void removeIdElement( String idVal ){
 2674               if (_idToElement != null)
 2675                   _idToElement.remove(idVal);
 2676           }
 2677           private java.util.Hashtable  _idToElement;
 2678       }
 2679       static class DocumentFragXobj extends NodeXobj implements DocumentFragment
 2680       {
 2681           DocumentFragXobj ( Locale l ) { super( l, ROOT, DomImpl.DOCFRAG ); }
 2682   
 2683           Xobj newNode ( Locale l ) { return new DocumentFragXobj( l ); }
 2684       }
 2685   
 2686       final static class ElementAttributes implements NamedNodeMap
 2687       {
 2688           ElementAttributes ( ElementXobj elementXobj )
 2689           {
 2690               _elementXobj = elementXobj;
 2691           }
 2692   
 2693           public int getLength ( ) { return DomImpl._attributes_getLength( _elementXobj ); }
 2694           public Node getNamedItem ( String name ) { return DomImpl._attributes_getNamedItem ( _elementXobj, name ); }
 2695           public Node getNamedItemNS ( String namespaceURI, String localName ) { return DomImpl._attributes_getNamedItemNS ( _elementXobj, namespaceURI, localName ); }
 2696           public Node item ( int index ) { return DomImpl._attributes_item ( _elementXobj, index ); }
 2697           public Node removeNamedItem ( String name ) { return DomImpl._attributes_removeNamedItem ( _elementXobj, name ); }
 2698           public Node removeNamedItemNS ( String namespaceURI, String localName ) { return DomImpl._attributes_removeNamedItemNS ( _elementXobj, namespaceURI, localName ); }
 2699           public Node setNamedItem ( Node arg ) { return DomImpl._attributes_setNamedItem ( _elementXobj, arg ); }
 2700           public Node setNamedItemNS ( Node arg ) { return DomImpl._attributes_setNamedItemNS ( _elementXobj, arg ); }
 2701   
 2702           private ElementXobj _elementXobj;
 2703       }
 2704   
 2705       static abstract class NamedNodeXobj extends NodeXobj
 2706       {
 2707           NamedNodeXobj ( Locale l, int kind, int domType )
 2708           {
 2709               super( l, kind, domType );
 2710               _canHavePrefixUri = true;
 2711           }
 2712   
 2713           public boolean nodeCanHavePrefixUri( ){ return _canHavePrefixUri; }
 2714   
 2715           boolean _canHavePrefixUri;
 2716       }
 2717       
 2718       static class ElementXobj extends NamedNodeXobj implements Element
 2719       {
 2720           ElementXobj ( Locale l, QName name )
 2721           {
 2722               super( l, ELEM, DomImpl.ELEMENT );
 2723               _name = name;
 2724           }
 2725   
 2726           Xobj newNode ( Locale l ) { return new ElementXobj( l, _name ); }
 2727   
 2728           //
 2729           //
 2730           //
 2731   
 2732           public NamedNodeMap getAttributes ( )
 2733           {
 2734               if (_attributes == null)
 2735                   _attributes = new ElementAttributes( this );
 2736   
 2737               return _attributes;
 2738           }
 2739   
 2740           public String getAttribute ( String name ) { return DomImpl._element_getAttribute( this, name ); }
 2741           public Attr getAttributeNode ( String name ) { return DomImpl._element_getAttributeNode( this, name ); }
 2742           public Attr getAttributeNodeNS ( String namespaceURI, String localName ) { return DomImpl._element_getAttributeNodeNS( this, namespaceURI, localName ); }
 2743           public String getAttributeNS ( String namespaceURI, String localName ) { return DomImpl._element_getAttributeNS( this, namespaceURI, localName ); }
 2744           public NodeList getElementsByTagName ( String name ) { return DomImpl._element_getElementsByTagName( this, name ); }
 2745           public NodeList getElementsByTagNameNS ( String namespaceURI, String localName ) { return DomImpl._element_getElementsByTagNameNS( this, namespaceURI, localName ); }
 2746           public String getTagName ( ) { return DomImpl._element_getTagName( this ); }
 2747           public boolean hasAttribute ( String name ) { return DomImpl._element_hasAttribute( this, name ); }
 2748           public boolean hasAttributeNS ( String namespaceURI, String localName ) { return DomImpl._element_hasAttributeNS( this, namespaceURI, localName ); }
 2749           public void removeAttribute ( String name ) { DomImpl._element_removeAttribute( this, name ); }
 2750           public Attr removeAttributeNode ( Attr oldAttr ) { return DomImpl._element_removeAttributeNode( this, oldAttr ); }
 2751           public void removeAttributeNS ( String namespaceURI, String localName ) { DomImpl._element_removeAttributeNS( this, namespaceURI, localName ); }
 2752           public void setAttribute ( String name, String value ) { DomImpl._element_setAttribute( this, name, value ); }
 2753           public Attr setAttributeNode ( Attr newAttr ) { return DomImpl._element_setAttributeNode( this, newAttr ); }
 2754           public Attr setAttributeNodeNS ( Attr newAttr ) { return DomImpl._element_setAttributeNodeNS( this, newAttr ); }
 2755           public void setAttributeNS ( String namespaceURI, String qualifiedName, String value ) { DomImpl._element_setAttributeNS( this, namespaceURI, qualifiedName, value ); }
 2756   
 2757           // DOM Level 3
 2758           public TypeInfo getSchemaTypeInfo ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2759           public void setIdAttribute ( String name, boolean isId ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2760           public void setIdAttributeNS ( String namespaceURI, String localName, boolean isId ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2761           public void setIdAttributeNode ( Attr idAttr, boolean isId ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2762   
 2763           private ElementAttributes _attributes;
 2764       }
 2765   
 2766       static class AttrXobj extends NamedNodeXobj implements Attr
 2767       {
 2768           AttrXobj ( Locale l, QName name )
 2769           {
 2770               super( l, ATTR, DomImpl.ATTR );
 2771               _name = name;
 2772           }
 2773   
 2774           Xobj newNode ( Locale l ) { return new AttrXobj( l, _name ); }
 2775   
 2776           //
 2777           public Node getNextSibling ( ) { return null; }
 2778           //
 2779   
 2780           public String getName ( ) { return DomImpl._node_getNodeName( this ); }
 2781           public Element getOwnerElement ( ) { return DomImpl._attr_getOwnerElement( this ); }
 2782           public boolean getSpecified ( ) { return DomImpl._attr_getSpecified( this ); }
 2783           public String getValue ( ) { return DomImpl._node_getNodeValue( this ); }
 2784           public void setValue ( String value ) { DomImpl._node_setNodeValue( this, value ); }
 2785   
 2786           // DOM Level 3
 2787           public TypeInfo getSchemaTypeInfo ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2788           public boolean isId ( ) { return false; }
 2789       }
 2790   
 2791        static class AttrIdXobj
 2792            extends AttrXobj
 2793        {
 2794            AttrIdXobj ( Locale l, QName name )
 2795           {
 2796               super( l, name );
 2797           }
 2798            public boolean isId()
 2799            {
 2800                return true;
 2801            }
 2802        }
 2803       static class CommentXobj extends NodeXobj implements Comment
 2804       {
 2805           CommentXobj ( Locale l ) { super( l, COMMENT, DomImpl.COMMENT ); }
 2806   
 2807           Xobj newNode ( Locale l ) { return new CommentXobj( l ); }
 2808   
 2809           public NodeList getChildNodes ( ) { return DomImpl._emptyNodeList; }
 2810   
 2811           public void appendData ( String arg ) { DomImpl._characterData_appendData( this, arg ); }
 2812           public void deleteData ( int offset, int count ) { DomImpl._characterData_deleteData( this, offset, count ); }
 2813           public String getData ( ) { return DomImpl._characterData_getData( this ); }
 2814           public int getLength ( ) { return DomImpl._characterData_getLength( this ); }
 2815           public Node getFirstChild ( ) { return null; }
 2816           public void insertData ( int offset, String arg ) { DomImpl._characterData_insertData( this, offset, arg ); }
 2817           public void replaceData ( int offset, int count, String arg ) { DomImpl._characterData_replaceData( this, offset, count, arg ); }
 2818           public void setData ( String data ) { DomImpl._characterData_setData( this, data ); }
 2819           public String substringData ( int offset, int count ) { return DomImpl._characterData_substringData( this, offset, count ); }
 2820       }
 2821   
 2822       static class ProcInstXobj extends NodeXobj implements ProcessingInstruction
 2823       {
 2824           ProcInstXobj ( Locale l, String target )
 2825           {
 2826               super( l, PROCINST, DomImpl.PROCINST );
 2827               _name = _locale.makeQName( null, target );
 2828           }
 2829   
 2830           Xobj newNode ( Locale l ) { return new ProcInstXobj( l, _name.getLocalPart() ); }
 2831   
 2832           public int getLength ( ) { return 0; }
 2833           public Node getFirstChild ( ) { return null; }
 2834   
 2835           public String getData ( ) { return DomImpl._processingInstruction_getData( this ); }
 2836           public String getTarget ( ) { return DomImpl._processingInstruction_getTarget( this ); }
 2837           public void setData ( String data ) { DomImpl._processingInstruction_setData( this, data ); }
 2838       }
 2839   
 2840       //
 2841       // SAAJ objects
 2842       //
 2843   
 2844       static class SoapPartDocXobj extends DocumentXobj
 2845       {
 2846           SoapPartDocXobj ( Locale l )
 2847           {
 2848               super(l);
 2849               //super( l, ROOT, DomImpl.DOCUMENT );
 2850               _soapPartDom = new SoapPartDom( this );
 2851           }
 2852   
 2853           Dom getDom ( ) { return _soapPartDom; }
 2854   
 2855           Xobj newNode ( Locale l ) { return new SoapPartDocXobj( l ); }
 2856   
 2857           SoapPartDom _soapPartDom;
 2858       }
 2859   
 2860       static class SoapPartDom extends SOAPPart implements Dom, Document, NodeList
 2861       {
 2862           SoapPartDom ( SoapPartDocXobj docXobj )
 2863           {
 2864               _docXobj = docXobj;
 2865           }
 2866   
 2867           public int    nodeType ( ) { return DomImpl.DOCUMENT;   }
 2868           public Locale locale   ( ) { return _docXobj._locale;   }
 2869           public Cur    tempCur  ( ) { return _docXobj.tempCur(); }
 2870           public QName  getQName ( ) { return _docXobj._name;     }
 2871   
 2872           public void dump ( ) { dump( System.out ); }
 2873           public void dump ( PrintStream o ) { _docXobj.dump( o ); }
 2874           public void dump ( PrintStream o, Object ref ) { _docXobj.dump( o, ref ); }
 2875   
 2876           public String name ( ) { return "#document"; }
 2877   
 2878           public Node appendChild ( Node newChild ) { return DomImpl._node_appendChild( this, newChild ); }
 2879           public Node cloneNode ( boolean deep ) { return DomImpl._node_cloneNode( this, deep ); }
 2880           public NamedNodeMap getAttributes ( ) { return null; }
 2881           public NodeList getChildNodes ( ) { return this; }
 2882           public Node getParentNode ( ) { return DomImpl._node_getParentNode( this ); }
 2883           public Node removeChild ( Node oldChild ) { return DomImpl._node_removeChild( this, oldChild ); }
 2884           public Node getFirstChild ( ) { return DomImpl._node_getFirstChild( this ); }
 2885           public Node getLastChild ( ) { return DomImpl._node_getLastChild( this ); }
 2886           public String getLocalName ( ) { return DomImpl._node_getLocalName( this ); }
 2887           public String getNamespaceURI ( ) { return DomImpl._node_getNamespaceURI( this ); }
 2888           public Node getNextSibling ( ) { return DomImpl._node_getNextSibling( this ); }
 2889           public String getNodeName ( ) { return DomImpl._node_getNodeName( this ); }
 2890           public short getNodeType ( ) { return DomImpl._node_getNodeType( this ); }
 2891           public String getNodeValue ( ) { return DomImpl._node_getNodeValue( this ); }
 2892           public Document getOwnerDocument ( ) { return DomImpl._node_getOwnerDocument( this ); }
 2893           public String getPrefix ( ) { return DomImpl._node_getPrefix( this ); }
 2894           public Node getPreviousSibling ( ) { return DomImpl._node_getPreviousSibling( this ); }
 2895           public boolean hasAttributes ( ) { return DomImpl._node_hasAttributes( this ); }
 2896           public boolean hasChildNodes ( ) { return DomImpl._node_hasChildNodes( this ); }
 2897           public Node insertBefore ( Node newChild, Node refChild ) { return DomImpl._node_insertBefore( this, newChild, refChild ); }
 2898           public boolean isSupported ( String feature, String version ) { return DomImpl._node_isSupported( this, feature, version ); }
 2899           public void normalize ( ) { DomImpl._node_normalize( this ); }
 2900           public Node replaceChild ( Node newChild, Node oldChild ) { return DomImpl._node_replaceChild( this, newChild, oldChild ); }
 2901           public void setNodeValue ( String nodeValue ) { DomImpl._node_setNodeValue( this, nodeValue ); }
 2902           public void setPrefix ( String prefix ) { DomImpl._node_setPrefix( this, prefix ); }
 2903   
 2904           // DOM Level 3
 2905           public Object getUserData ( String key ) { return DomImpl._node_getUserData( this, key ); }
 2906           public Object setUserData ( String key, Object data, UserDataHandler handler ) { return DomImpl._node_setUserData( this, key, data, handler ); }
 2907           public Object getFeature ( String feature, String version ) { return DomImpl._node_getFeature( this, feature, version ); }
 2908           public boolean isEqualNode ( Node arg ) { return DomImpl._node_isEqualNode( this, arg ); }
 2909           public boolean isSameNode ( Node arg ) { return DomImpl._node_isSameNode( this, arg ); }
 2910           public String lookupNamespaceURI ( String prefix ) { return DomImpl._node_lookupNamespaceURI( this, prefix ); }
 2911           public String lookupPrefix ( String namespaceURI ) { return DomImpl._node_lookupPrefix( this, namespaceURI ); }
 2912           public boolean isDefaultNamespace ( String namespaceURI ) { return DomImpl._node_isDefaultNamespace( this, namespaceURI ); }
 2913           public void setTextContent ( String textContent ) { DomImpl._node_setTextContent( this, textContent ); }
 2914           public String getTextContent ( ) { return DomImpl._node_getTextContent( this ); }
 2915           public short compareDocumentPosition ( Node other ) { return DomImpl._node_compareDocumentPosition( this, other ); }
 2916           public String getBaseURI ( ) { return DomImpl._node_getBaseURI( this ); }
 2917           public Node adoptNode ( Node source ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2918           public String getDocumentURI ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2919           public DOMConfiguration getDomConfig ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2920           public String getInputEncoding ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2921           public boolean getStrictErrorChecking ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2922           public String getXmlEncoding ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2923           public boolean getXmlStandalone ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2924           public String getXmlVersion ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2925           public void normalizeDocument ( ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2926           public Node renameNode ( Node n, String namespaceURI, String qualifiedName ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2927           public void setDocumentURI ( String documentURI ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2928           public void setStrictErrorChecking ( boolean strictErrorChecking ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2929           public void setXmlStandalone ( boolean xmlStandalone ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2930           public void setXmlVersion ( String xmlVersion ) { throw new RuntimeException( "DOM Level 3 Not implemented" ); }
 2931   
 2932           public Attr createAttribute ( String name ) { return DomImpl._document_createAttribute( this, name ); }
 2933           public Attr createAttributeNS ( String namespaceURI, String qualifiedName ) { return DomImpl._document_createAttributeNS( this, namespaceURI, qualifiedName ); }
 2934           public CDATASection createCDATASection ( String data ) { return DomImpl._document_createCDATASection( this, data ); }
 2935           public Comment createComment ( String data ) { return DomImpl._document_createComment( this, data ); }
 2936           public DocumentFragment createDocumentFragment ( ) { return DomImpl._document_createDocumentFragment( this ); }
 2937           public Element createElement ( String tagName ) { return DomImpl._document_createElement( this, tagName ); }
 2938           public Element createElementNS ( String namespaceURI, String qualifiedName ) { return DomImpl._document_createElementNS( this, namespaceURI, qualifiedName ); }
 2939           public EntityReference createEntityReference ( String name ) { return DomImpl._document_createEntityReference( this, name ); }
 2940           public ProcessingInstruction createProcessingInstruction ( String target, String data ) { return DomImpl._document_createProcessingInstruction( this, target, data ); }
 2941           public Text createTextNode ( String data ) { return DomImpl._document_createTextNode( this, data ); }
 2942           public DocumentType getDoctype ( ) { return DomImpl._document_getDoctype( this ); }
 2943           public Element getDocumentElement ( ) { return DomImpl._document_getDocumentElement( this ); }
 2944           public Element getElementById ( String elementId ) { return DomImpl._document_getElementById( this, elementId ); }
 2945           public NodeList getElementsByTagName ( String tagname ) { return DomImpl._document_getElementsByTagName( this, tagname ); }
 2946           public NodeList getElementsByTagNameNS ( String namespaceURI, String localName ) { return DomImpl._document_getElementsByTagNameNS( this, namespaceURI, localName ); }
 2947           public DOMImplementation getImplementation ( ) { return DomImpl._document_getImplementation( this ); }
 2948           public Node importNode ( Node importedNode, boolean deep ) { return DomImpl._document_importNode( this, importedNode, deep ); }
 2949   
 2950           public int getLength ( ) { return DomImpl._childNodes_getLength( this ); }
 2951           public Node item ( int i ) { return DomImpl._childNodes_item( this, i ); }
 2952   
 2953           public void removeAllMimeHeaders ( ) { DomImpl._soapPart_removeAllMimeHeaders( this ); }
 2954           public void removeMimeHeader ( String name ) { DomImpl._soapPart_removeMimeHeader( this, name ); }
 2955           public Iterator getAllMimeHeaders ( ) { return DomImpl._soapPart_getAllMimeHeaders( this ); }
 2956           public SOAPEnvelope getEnvelope ( ) { return DomImpl._soapPart_getEnvelope( this ); }
 2957           public Source getContent ( ) { return DomImpl._soapPart_getContent( this ); }
 2958           public void setContent ( Source source ) { DomImpl._soapPart_setContent( this, source ); }
 2959           public String[] getMimeHeader ( String name ) { return DomImpl._soapPart_getMimeHeader( this, name ); }
 2960           public void addMimeHeader ( String name, String value ) { DomImpl._soapPart_addMimeHeader( this, name,value ); }
 2961           public void setMimeHeader ( String name, String value ) { DomImpl._soapPart_setMimeHeader( this, name, value ); }
 2962           public Iterator getMatchingMimeHeaders ( String[] names ) { return DomImpl._soapPart_getMatchingMimeHeaders( this, names ); }
 2963           public Iterator getNonMatchingMimeHeaders ( String[] names ) { return DomImpl._soapPart_getNonMatchingMimeHeaders( this, names ); }
 2964   
 2965           public boolean nodeCanHavePrefixUri( ){ return true; }
 2966   
 2967           SoapPartDocXobj _docXobj;
 2968       }
 2969   
 2970       static class SoapElementXobj
 2971           extends ElementXobj implements SOAPElement, org.apache.xmlbeans.impl.soap.Node
 2972       {
 2973           SoapElementXobj ( Locale l, QName name ) { super( l, name ); }
 2974   
 2975           Xobj newNode ( Locale l ) { return new SoapElementXobj( l, _name ); }
 2976   
 2977           public void detachNode ( ) { DomImpl._soapNode_detachNode( this ); }
 2978           public void recycleNode ( ) { DomImpl._soapNode_recycleNode( this ); }
 2979           public String getValue ( ) { return DomImpl._soapNode_getValue( this ); }
 2980           public void setValue ( String value ) { DomImpl._soapNode_setValue( this, value ); }
 2981           public SOAPElement getParentElement ( ) { return DomImpl._soapNode_getParentElement( this ); }
 2982           public void setParentElement ( SOAPElement p ) { DomImpl._soapNode_setParentElement( this, p ); }
 2983   
 2984           public void removeContents ( ) { DomImpl._soapElement_removeContents( this ); }
 2985           public String getEncodingStyle ( ) { return DomImpl._soapElement_getEncodingStyle( this ); }
 2986           public void setEncodingStyle ( String encodingStyle ) { DomImpl._soapElement_setEncodingStyle( this, encodingStyle ); }
 2987           public boolean removeNamespaceDeclaration ( String prefix ) { return DomImpl._soapElement_removeNamespaceDeclaration( this, prefix ); }
 2988           public Iterator getAllAttributes ( ) { return DomImpl._soapElement_getAllAttributes( this ); }
 2989           public Iterator getChildElements ( ) { return DomImpl._soapElement_getChildElements( this ); }
 2990           public Iterator getNamespacePrefixes ( ) { return DomImpl._soapElement_getNamespacePrefixes( this ); }
 2991           public SOAPElement addAttribute ( Name name, String value ) throws SOAPException { return DomImpl._soapElement_addAttribute( this, name, value ); }
 2992           public SOAPElement addChildElement ( SOAPElement oldChild ) throws SOAPException { return DomImpl._soapElement_addChildElement( this, oldChild ); }
 2993           public SOAPElement addChildElement ( Name name ) throws SOAPException { return DomImpl._soapElement_addChildElement( this, name ); }
 2994           public SOAPElement addChildElement ( String localName ) throws SOAPException { return DomImpl._soapElement_addChildElement( this, localName ); }
 2995           public SOAPElement addChildElement ( String localName, String prefix ) throws SOAPException { return DomImpl._soapElement_addChildElement( this, localName, prefix ); }
 2996           public SOAPElement addChildElement ( String localName, String prefix, String uri ) throws SOAPException { return DomImpl._soapElement_addChildElement( this, localName, prefix, uri ); }
 2997           public SOAPElement addNamespaceDeclaration ( String prefix, String uri ) { return DomImpl._soapElement_addNamespaceDeclaration( this, prefix, uri ); }
 2998           public SOAPElement addTextNode ( String data ) { return DomImpl._soapElement_addTextNode( this, data ); }
 2999           public String getAttributeValue ( Name name ) { return DomImpl._soapElement_getAttributeValue( this, name ); }
 3000           public Iterator getChildElements ( Name name ) { return DomImpl._soapElement_getChildElements( this, name ); }
 3001           public Name getElementName ( ) { return DomImpl._soapElement_getElementName( this ); }
 3002           public String getNamespaceURI ( String prefix ) { return DomImpl._soapElement_getNamespaceURI( this, prefix ); }
 3003           public Iterator getVisibleNamespacePrefixes ( ) { return DomImpl._soapElement_getVisibleNamespacePrefixes( this ); }
 3004           public boolean removeAttribute ( Name name ) { return DomImpl._soapElement_removeAttribute( this, name ); }
 3005       }
 3006   
 3007       static class SoapBodyXobj extends SoapElementXobj implements SOAPBody
 3008       {
 3009           SoapBodyXobj ( Locale l, QName name ) { super( l, name ); }
 3010   
 3011           Xobj newNode ( Locale l ) { return new SoapBodyXobj( l, _name ); }
 3012   
 3013           public boolean hasFault ( ) { return DomImpl.soapBody_hasFault( this ); }
 3014           public SOAPFault addFault ( ) throws SOAPException { return DomImpl.soapBody_addFault( this ); }
 3015           public SOAPFault getFault ( ) { return DomImpl.soapBody_getFault( this ); }
 3016           public SOAPBodyElement addBodyElement ( Name name ) { return DomImpl.soapBody_addBodyElement( this, name ); }
 3017           public SOAPBodyElement addDocument ( Document document ) { return DomImpl.soapBody_addDocument( this, document ); }
 3018           public SOAPFault addFault ( Name name, String s ) throws SOAPException { return DomImpl.soapBody_addFault( this, name, s ); }
 3019           public SOAPFault addFault ( Name faultCode, String faultString, java.util.Locale locale ) throws SOAPException { return DomImpl.soapBody_addFault( this, faultCode, faultString, locale ); }
 3020       }
 3021   
 3022       static class SoapBodyElementXobj extends SoapElementXobj implements SOAPBodyElement
 3023       {
 3024           SoapBodyElementXobj ( Locale l, QName name ) { super( l, name ); }
 3025   
 3026           Xobj newNode ( Locale l ) { return new SoapBodyElementXobj( l, _name ); }
 3027       }
 3028   
 3029       static class SoapEnvelopeXobj extends SoapElementXobj implements SOAPEnvelope
 3030       {
 3031           SoapEnvelopeXobj ( Locale l, QName name ) { super( l, name ); }
 3032   
 3033           Xobj newNode ( Locale l ) { return new SoapEnvelopeXobj( l, _name ); }
 3034   
 3035           public SOAPBody addBody ( ) throws SOAPException { return DomImpl._soapEnvelope_addBody( this ); }
 3036           public SOAPBody getBody ( ) throws SOAPException { return DomImpl._soapEnvelope_getBody( this ); }
 3037           public SOAPHeader getHeader ( ) throws SOAPException { return DomImpl._soapEnvelope_getHeader( this ); }
 3038           public SOAPHeader addHeader ( ) throws SOAPException { return DomImpl._soapEnvelope_addHeader( this ); }
 3039           public Name createName ( String localName ) { return DomImpl._soapEnvelope_createName( this, localName ); }
 3040           public Name createName ( String localName, String prefix, String namespaceURI ) { return DomImpl._soapEnvelope_createName( this, localName, prefix, namespaceURI ); }
 3041       }
 3042   
 3043       static class SoapHeaderXobj extends SoapElementXobj implements SOAPHeader
 3044       {
 3045           SoapHeaderXobj ( Locale l, QName name ) { super( l, name ); }
 3046   
 3047           Xobj newNode ( Locale l ) { return new SoapHeaderXobj( l, _name ); }
 3048   
 3049           public Iterator examineAllHeaderElements ( ) { return DomImpl.soapHeader_examineAllHeaderElements( this ); }
 3050           public Iterator extractAllHeaderElements ( ) { return DomImpl.soapHeader_extractAllHeaderElements( this ); }
 3051           public Iterator examineHeaderElements ( String actor ) { return DomImpl.soapHeader_examineHeaderElements( this, actor ); }
 3052           public Iterator examineMustUnderstandHeaderElements ( String mustUnderstandString ) { return DomImpl.soapHeader_examineMustUnderstandHeaderElements( this, mustUnderstandString ); }
 3053           public Iterator extractHeaderElements ( String actor ) { return DomImpl.soapHeader_extractHeaderElements( this, actor ); }
 3054           public SOAPHeaderElement addHeaderElement ( Name name ) { return DomImpl.soapHeader_addHeaderElement( this, name ); }
 3055       }
 3056   
 3057       static class SoapHeaderElementXobj extends SoapElementXobj implements SOAPHeaderElement
 3058       {
 3059           SoapHeaderElementXobj ( Locale l, QName name ) { super( l, name ); }
 3060   
 3061           Xobj newNode ( Locale l ) { return new SoapHeaderElementXobj( l, _name ); }
 3062   
 3063           public void setMustUnderstand ( boolean mustUnderstand ) { DomImpl.soapHeaderElement_setMustUnderstand( this, mustUnderstand ); }
 3064           public boolean getMustUnderstand ( ) { return DomImpl.soapHeaderElement_getMustUnderstand( this ); }
 3065           public void setActor ( String actor ) { DomImpl.soapHeaderElement_setActor( this, actor ); }
 3066           public String getActor ( ) { return DomImpl.soapHeaderElement_getActor( this ); }
 3067       }
 3068   
 3069       static class SoapFaultXobj extends SoapBodyElementXobj implements SOAPFault
 3070       {
 3071           SoapFaultXobj ( Locale l, QName name ) { super( l, name ); }
 3072   
 3073           Xobj newNode ( Locale l ) { return new SoapFaultXobj( l, _name ); }
 3074   
 3075           public void setFaultString ( String faultString ) { DomImpl.soapFault_setFaultString( this, faultString ); }
 3076           public void setFaultString ( String faultString, java.util.Locale locale ) { DomImpl.soapFault_setFaultString( this, faultString, locale ); }
 3077           public void setFaultCode ( Name faultCodeName ) throws SOAPException { DomImpl.soapFault_setFaultCode( this, faultCodeName ); }
 3078           public void setFaultActor ( String faultActorString ) { DomImpl.soapFault_setFaultActor( this, faultActorString ); }
 3079           public String getFaultActor ( ) { return DomImpl.soapFault_getFaultActor( this ); }
 3080           public String getFaultCode ( ) { return DomImpl.soapFault_getFaultCode( this ); }
 3081           public void setFaultCode ( String faultCode ) throws SOAPException { DomImpl.soapFault_setFaultCode( this, faultCode ); }
 3082           public java.util.Locale getFaultStringLocale ( ) { return DomImpl.soapFault_getFaultStringLocale( this ); }
 3083           public Name getFaultCodeAsName ( ) { return DomImpl.soapFault_getFaultCodeAsName( this ); }
 3084           public String getFaultString ( ) { return DomImpl.soapFault_getFaultString( this ); }
 3085           public Detail addDetail ( ) throws SOAPException { return DomImpl.soapFault_addDetail( this ); }
 3086           public Detail getDetail ( ) { return DomImpl.soapFault_getDetail( this ); }
 3087       }
 3088   
 3089       static class SoapFaultElementXobj extends SoapElementXobj implements SOAPFaultElement
 3090       {
 3091           SoapFaultElementXobj ( Locale l, QName name ) { super( l, name ); }
 3092   
 3093           Xobj newNode ( Locale l ) { return new SoapFaultElementXobj( l, _name ); }
 3094       }
 3095   
 3096       static class DetailXobj extends SoapFaultElementXobj implements Detail
 3097       {
 3098           DetailXobj ( Locale l, QName name ) { super( l, name ); }
 3099   
 3100           Xobj newNode ( Locale l ) { return new DetailXobj( l, _name ); }
 3101   
 3102           public DetailEntry addDetailEntry ( Name name ) { return DomImpl.detail_addDetailEntry( this, name ); }
 3103           public Iterator getDetailEntries ( ) { return DomImpl.detail_getDetailEntries( this ); }
 3104       }
 3105   
 3106       static class DetailEntryXobj extends SoapElementXobj implements DetailEntry
 3107       {
 3108           Xobj newNode ( Locale l ) { return new DetailEntryXobj( l, _name ); }
 3109   
 3110           DetailEntryXobj ( Locale l, QName name ) { super( l, name ); }
 3111       }
 3112   
 3113       //
 3114       //
 3115       //
 3116   
 3117       static class Bookmark implements XmlMark
 3118       {
 3119           boolean isOnList ( Bookmark head )
 3120           {
 3121               for ( ; head != null ; head = head._next )
 3122                   if (head == this)
 3123                       return true;
 3124   
 3125               return false;
 3126           }
 3127   
 3128           Bookmark listInsert ( Bookmark head )
 3129           {
 3130               assert _next == null && _prev == null;
 3131   
 3132               if (head == null)
 3133                   head = _prev = this;
 3134               else
 3135               {
 3136                   _prev = head._prev;
 3137                   head._prev = head._prev._next = this;
 3138               }
 3139   
 3140               return head;
 3141           }
 3142   
 3143           Bookmark listRemove ( Bookmark head )
 3144           {
 3145               assert _prev != null && isOnList( head );
 3146   
 3147               if (_prev == this)
 3148                   head = null;
 3149               else
 3150               {
 3151                   if (head == this)
 3152                       head = _next;
 3153                   else
 3154                       _prev._next = _next;
 3155   
 3156                   if (_next == null)
 3157                       head._prev = _prev;
 3158                   else
 3159                   {
 3160                       _next._prev = _prev;
 3161                       _next = null;
 3162                   }
 3163               }
 3164   
 3165               _prev = null;
 3166               assert _next == null;
 3167   
 3168               return head;
 3169           }
 3170   
 3171           void moveTo ( Xobj x, int p )
 3172           {
 3173               assert isOnList( _xobj._bookmarks );
 3174   
 3175               if (_xobj != x)
 3176               {
 3177                   _xobj._bookmarks = listRemove( _xobj._bookmarks );
 3178                   x._bookmarks = listInsert( x._bookmarks );
 3179   
 3180                   _xobj = x;
 3181               }
 3182   
 3183               _pos = p;
 3184           }
 3185   
 3186           //
 3187           // XmlCursor.XmlMark method
 3188           //
 3189   
 3190           public XmlCursor createCursor ( )
 3191           {
 3192               if (_xobj == null)
 3193               {
 3194                   throw new IllegalStateException(
 3195                       "Attempting to create a cursor on a bookmark that " +
 3196                           "has been cleared or replaced.");
 3197               }
 3198   
 3199               return Cursor.newCursor( _xobj, _pos );
 3200           }
 3201   
 3202           //
 3203           //
 3204           //
 3205   
 3206           Xobj _xobj;
 3207           int  _pos;
 3208   
 3209           Bookmark _next;
 3210           Bookmark _prev;
 3211   
 3212           Object _key;
 3213           Object _value;
 3214       }
 3215   
 3216       //
 3217       //
 3218       //
 3219   
 3220       Locale _locale;
 3221       QName _name;
 3222   
 3223       Cur _embedded;
 3224   
 3225       Bookmark _bookmarks;
 3226   
 3227       int _bits;
 3228   
 3229       Xobj _parent;
 3230       Xobj _nextSibling;
 3231       Xobj _prevSibling;
 3232       Xobj _firstChild;
 3233       Xobj _lastChild;
 3234   
 3235       Object _srcValue, _srcAfter;
 3236       int    _offValue, _offAfter;
 3237       int    _cchValue, _cchAfter;
 3238   
 3239       // TODO - put this in a ptr off this node
 3240       CharNode _charNodesValue;
 3241       CharNode _charNodesAfter;
 3242   
 3243       // TODO - put this in a ptr off this node
 3244       TypeStoreUser _user;
 3245   }

Save This Page
Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.impl » store » [javadoc | source]