Save This Page
Home » openjdk-7 » com.sun.org.apache.xerces.internal » dom » [javadoc | source]
    1   /*
    2    * reserved comment block
    3    * DO NOT REMOVE OR ALTER!
    4    */
    5   /*
    6    * Copyright 1999-2002,2004 The Apache Software Foundation.
    7    *
    8    * Licensed under the Apache License, Version 2.0 (the "License");
    9    * you may not use this file except in compliance with the License.
   10    * 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   
   23   /**
   24    * XML provides the CDATA markup to allow a region of text in which
   25    * most of the XML delimiter recognition does not take place. This is
   26    * intended to ease the task of quoting XML fragments and other
   27    * programmatic information in a document's text without needing to
   28    * escape these special characters. It's primarily a convenience feature
   29    * for those who are hand-editing XML.
   30    * <P>
   31    * CDATASection is an Extended DOM feature, and is not used in HTML
   32    * contexts.
   33    * <P>
   34    * Within the DOM, CDATASections are treated essentially as Text
   35    * blocks. Their distinct type is retained in order to allow us to
   36    * properly recreate the XML syntax when we write them out.
   37    * <P>
   38    * Reminder: CDATA IS NOT A COMPLETELY GENERAL SOLUTION; it can't
   39    * quote its own end-of-block marking. If you need to write out a
   40    * CDATA that contains the ]]> sequence, it's your responsibility to
   41    * split that string over two successive CDATAs at that time.
   42    * <P>
   43    * CDATA does not participate in Element.normalize() processing.
   44    *
   45    * @xerces.internal
   46    *
   47    * @since  PR-DOM-Level-1-19980818.
   48    */
   49   public class DeferredCDATASectionImpl
   50       extends CDATASectionImpl
   51       implements DeferredNode {
   52   
   53       //
   54       // Constants
   55       //
   56   
   57       /** Serialization version. */
   58       static final long serialVersionUID = 1983580632355645726L;
   59   
   60       //
   61       // Data
   62       //
   63   
   64       /** Node index. */
   65       protected transient int fNodeIndex;
   66   
   67       //
   68       // Constructors
   69       //
   70   
   71       /**
   72        * This is the deferred constructor. Only the fNodeIndex is given here. All other data,
   73        * can be requested from the ownerDocument via the index.
   74        */
   75       DeferredCDATASectionImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) {
   76           super(ownerDocument, null);
   77   
   78           fNodeIndex = nodeIndex;
   79           needsSyncData(true);
   80   
   81       } // <init>(DeferredDocumentImpl,int)
   82   
   83       //
   84       // DeferredNode methods
   85       //
   86   
   87       /** Returns the node index. */
   88       public int getNodeIndex() {
   89           return fNodeIndex;
   90       }
   91   
   92       //
   93       // Protected methods
   94       //
   95   
   96       /** Synchronizes the data (name and value) for fast nodes. */
   97       protected void synchronizeData() {
   98   
   99           // no need to sync in the future
  100           needsSyncData(false);
  101   
  102           // fluff data
  103           DeferredDocumentImpl ownerDocument =
  104               (DeferredDocumentImpl) this.ownerDocument();
  105           data = ownerDocument.getNodeValueString(fNodeIndex);
  106   
  107       } // synchronizeData()
  108   
  109   } // class DeferredCDATASectionImpl

Save This Page
Home » openjdk-7 » com.sun.org.apache.xerces.internal » dom » [javadoc | source]