< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java

Print this page


   1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xerces.internal.dom;
  22 


 352     /** Creates an entity reference node in the table. */
 353     public int createDeferredEntityReference(String name, String baseURI) {
 354 
 355         // create node
 356         int nodeIndex = createNode(Node.ENTITY_REFERENCE_NODE);
 357         int chunk     = nodeIndex >> CHUNK_SHIFT;
 358         int index     = nodeIndex & CHUNK_MASK;
 359         setChunkValue(fNodeName, name, chunk, index);
 360         setChunkValue(fNodeValue, baseURI, chunk, index);
 361 
 362         // return node index
 363         return nodeIndex;
 364 
 365     } // createDeferredEntityReference(String):int
 366 
 367 
 368     /**
 369      * Creates an element node with a URI in the table and type information.
 370      * @deprecated
 371      */

 372     public int createDeferredElement(String elementURI, String elementName,
 373                                       Object type) {
 374 
 375         // create node
 376         int elementNodeIndex = createNode(Node.ELEMENT_NODE);
 377         int elementChunk     = elementNodeIndex >> CHUNK_SHIFT;
 378         int elementIndex     = elementNodeIndex & CHUNK_MASK;
 379         setChunkValue(fNodeName, elementName, elementChunk, elementIndex);
 380         setChunkValue(fNodeURI, elementURI, elementChunk, elementIndex);
 381         setChunkValue(fNodeValue, type, elementChunk, elementIndex);
 382 
 383         // return node index
 384         return elementNodeIndex;
 385 
 386     } // createDeferredElement(String,String,Object):int
 387 
 388     /**
 389      * Creates an element node in the table.
 390      * @deprecated
 391      */

 392     public int createDeferredElement(String elementName) {
 393         return createDeferredElement(null, elementName);
 394     }
 395 
 396     /**
 397      * Creates an element node with a URI in the table.
 398      */
 399     public int createDeferredElement(String elementURI, String elementName) {
 400 
 401         // create node
 402         int elementNodeIndex = createNode(Node.ELEMENT_NODE);
 403         int elementChunk     = elementNodeIndex >> CHUNK_SHIFT;
 404         int elementIndex     = elementNodeIndex & CHUNK_MASK;
 405         setChunkValue(fNodeName, elementName, elementChunk, elementIndex);
 406         setChunkValue(fNodeURI, elementURI, elementChunk, elementIndex);
 407 
 408         // return node index
 409         return elementNodeIndex;
 410 
 411     } // createDeferredElement(String,String):int


 457                         putIdentifier(value, elementNodeIndex);
 458                 }
 459                 // store type information
 460                 if (type != null) {
 461                         int extraDataIndex = createNode(DeferredNode.TYPE_NODE);
 462                         int echunk = extraDataIndex >> CHUNK_SHIFT;
 463                         int eindex = extraDataIndex & CHUNK_MASK;
 464 
 465                         setChunkIndex(fNodeLastChild, extraDataIndex, attrChunk, attrIndex);
 466                         setChunkValue(fNodeValue, type, echunk, eindex);
 467                 }
 468 
 469                 // return node index
 470                 return attrNodeIndex;
 471         }
 472 
 473     /**
 474      * Sets an attribute on an element node.
 475      * @deprecated
 476      */

 477     public int setDeferredAttribute(int elementNodeIndex,
 478                                     String attrName, String attrURI,
 479                                     String attrValue, boolean specified) {
 480         // create attribute
 481         int attrNodeIndex = createDeferredAttribute(attrName, attrURI,
 482                                                     attrValue, specified);
 483         int attrChunk = attrNodeIndex >> CHUNK_SHIFT;
 484         int attrIndex  = attrNodeIndex & CHUNK_MASK;
 485         // set attribute's parent to element
 486         setChunkIndex(fNodeParent, elementNodeIndex, attrChunk, attrIndex);
 487 
 488         int elementChunk     = elementNodeIndex >> CHUNK_SHIFT;
 489         int elementIndex     = elementNodeIndex & CHUNK_MASK;
 490 
 491         // get element's last attribute
 492         int lastAttrNodeIndex = getChunkIndex(fNodeExtra,
 493                                               elementChunk, elementIndex);
 494         if (lastAttrNodeIndex != 0) {
 495             // add link from new attribute to last attribute
 496             setChunkIndex(fNodePrevSib, lastAttrNodeIndex,


   1 /*
   2  * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xerces.internal.dom;
  22 


 352     /** Creates an entity reference node in the table. */
 353     public int createDeferredEntityReference(String name, String baseURI) {
 354 
 355         // create node
 356         int nodeIndex = createNode(Node.ENTITY_REFERENCE_NODE);
 357         int chunk     = nodeIndex >> CHUNK_SHIFT;
 358         int index     = nodeIndex & CHUNK_MASK;
 359         setChunkValue(fNodeName, name, chunk, index);
 360         setChunkValue(fNodeValue, baseURI, chunk, index);
 361 
 362         // return node index
 363         return nodeIndex;
 364 
 365     } // createDeferredEntityReference(String):int
 366 
 367 
 368     /**
 369      * Creates an element node with a URI in the table and type information.
 370      * @deprecated
 371      */
 372     @Deprecated
 373     public int createDeferredElement(String elementURI, String elementName,
 374                                       Object type) {
 375 
 376         // create node
 377         int elementNodeIndex = createNode(Node.ELEMENT_NODE);
 378         int elementChunk     = elementNodeIndex >> CHUNK_SHIFT;
 379         int elementIndex     = elementNodeIndex & CHUNK_MASK;
 380         setChunkValue(fNodeName, elementName, elementChunk, elementIndex);
 381         setChunkValue(fNodeURI, elementURI, elementChunk, elementIndex);
 382         setChunkValue(fNodeValue, type, elementChunk, elementIndex);
 383 
 384         // return node index
 385         return elementNodeIndex;
 386 
 387     } // createDeferredElement(String,String,Object):int
 388 
 389     /**
 390      * Creates an element node in the table.
 391      * @deprecated
 392      */
 393     @Deprecated
 394     public int createDeferredElement(String elementName) {
 395         return createDeferredElement(null, elementName);
 396     }
 397 
 398     /**
 399      * Creates an element node with a URI in the table.
 400      */
 401     public int createDeferredElement(String elementURI, String elementName) {
 402 
 403         // create node
 404         int elementNodeIndex = createNode(Node.ELEMENT_NODE);
 405         int elementChunk     = elementNodeIndex >> CHUNK_SHIFT;
 406         int elementIndex     = elementNodeIndex & CHUNK_MASK;
 407         setChunkValue(fNodeName, elementName, elementChunk, elementIndex);
 408         setChunkValue(fNodeURI, elementURI, elementChunk, elementIndex);
 409 
 410         // return node index
 411         return elementNodeIndex;
 412 
 413     } // createDeferredElement(String,String):int


 459                         putIdentifier(value, elementNodeIndex);
 460                 }
 461                 // store type information
 462                 if (type != null) {
 463                         int extraDataIndex = createNode(DeferredNode.TYPE_NODE);
 464                         int echunk = extraDataIndex >> CHUNK_SHIFT;
 465                         int eindex = extraDataIndex & CHUNK_MASK;
 466 
 467                         setChunkIndex(fNodeLastChild, extraDataIndex, attrChunk, attrIndex);
 468                         setChunkValue(fNodeValue, type, echunk, eindex);
 469                 }
 470 
 471                 // return node index
 472                 return attrNodeIndex;
 473         }
 474 
 475     /**
 476      * Sets an attribute on an element node.
 477      * @deprecated
 478      */
 479     @Deprecated
 480     public int setDeferredAttribute(int elementNodeIndex,
 481                                     String attrName, String attrURI,
 482                                     String attrValue, boolean specified) {
 483         // create attribute
 484         int attrNodeIndex = createDeferredAttribute(attrName, attrURI,
 485                                                     attrValue, specified);
 486         int attrChunk = attrNodeIndex >> CHUNK_SHIFT;
 487         int attrIndex  = attrNodeIndex & CHUNK_MASK;
 488         // set attribute's parent to element
 489         setChunkIndex(fNodeParent, elementNodeIndex, attrChunk, attrIndex);
 490 
 491         int elementChunk     = elementNodeIndex >> CHUNK_SHIFT;
 492         int elementIndex     = elementNodeIndex & CHUNK_MASK;
 493 
 494         // get element's last attribute
 495         int lastAttrNodeIndex = getChunkIndex(fNodeExtra,
 496                                               elementChunk, elementIndex);
 497         if (lastAttrNodeIndex != 0) {
 498             // add link from new attribute to last attribute
 499             setChunkIndex(fNodePrevSib, lastAttrNodeIndex,


< prev index next >