1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xerces.internal.dom;
  23 
  24 /**
  25  * Processing Instructions (PIs) permit documents to carry
  26  * processor-specific information alongside their actual content. PIs
  27  * are most common in XML, but they are supported in HTML as well.
  28  *
  29  * @xerces.internal
  30  *
  31  * @since  PR-DOM-Level-1-19980818.
  32  */
  33 public class DeferredProcessingInstructionImpl
  34     extends ProcessingInstructionImpl
  35     implements DeferredNode {
  36 
  37     //
  38     // Constants
  39     //
  40 
  41     /** Serialization version. */
  42     static final long serialVersionUID = -4643577954293565388L;
  43 
  44     //
  45     // Data
  46     //
  47 
  48     /** Node index. */
  49     protected transient int fNodeIndex;
  50 
  51     //
  52     // Constructors
  53     //
  54 
  55     /**
  56      * This is the deferred constructor. Only the fNodeIndex is given here.
  57      * All other data, can be requested from the ownerDocument via the index.
  58      */
  59     DeferredProcessingInstructionImpl(DeferredDocumentImpl ownerDocument,
  60                                       int nodeIndex) {
  61         super(ownerDocument, null, null);
  62 
  63         fNodeIndex = nodeIndex;
  64         needsSyncData(true);
  65 
  66     } // <init>(DeferredDocumentImpl,int)
  67 
  68     //
  69     // DeferredNode methods
  70     //
  71 
  72     /** Returns the node index. */
  73     public int getNodeIndex() {
  74         return fNodeIndex;
  75     }
  76 
  77     //
  78     // Protected methods
  79     //
  80 
  81     /** Synchronizes the data. */
  82     protected void synchronizeData() {
  83 
  84         // no need to sync in the future
  85         needsSyncData(false);
  86 
  87         // fluff data
  88         DeferredDocumentImpl ownerDocument =
  89             (DeferredDocumentImpl) this.ownerDocument();
  90         target  = ownerDocument.getNodeName(fNodeIndex);
  91         data = ownerDocument.getNodeValueString(fNodeIndex);
  92 
  93     } // synchronizeData()
  94 
  95 } // class DeferredProcessingInstructionImpl