KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > dom > DeferredProcessingInstructionImpl


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.dom;
18
19 /**
20  * Processing Instructions (PIs) permit documents to carry
21  * processor-specific information alongside their actual content. PIs
22  * are most common in XML, but they are supported in HTML as well.
23  *
24  * @xerces.internal
25  *
26  * @version $Id: DeferredProcessingInstructionImpl.java,v 1.14 2004/10/05 17:12:50 mrglavas Exp $
27  * @since PR-DOM-Level-1-19980818.
28  */

29 public class DeferredProcessingInstructionImpl
30     extends ProcessingInstructionImpl
31     implements DeferredNode {
32
33     //
34
// Constants
35
//
36

37     /** Serialization version. */
38     static final long serialVersionUID = -4643577954293565388L;
39     
40     //
41
// Data
42
//
43

44     /** Node index. */
45     protected transient int fNodeIndex;
46
47     //
48
// Constructors
49
//
50

51     /**
52      * This is the deferred constructor. Only the fNodeIndex is given here.
53      * All other data, can be requested from the ownerDocument via the index.
54      */

55     DeferredProcessingInstructionImpl(DeferredDocumentImpl ownerDocument,
56                                       int nodeIndex) {
57         super(ownerDocument, null, null);
58
59         fNodeIndex = nodeIndex;
60         needsSyncData(true);
61
62     } // <init>(DeferredDocumentImpl,int)
63

64     //
65
// DeferredNode methods
66
//
67

68     /** Returns the node index. */
69     public int getNodeIndex() {
70         return fNodeIndex;
71     }
72
73     //
74
// Protected methods
75
//
76

77     /** Synchronizes the data. */
78     protected void synchronizeData() {
79
80         // no need to sync in the future
81
needsSyncData(false);
82
83         // fluff data
84
DeferredDocumentImpl ownerDocument =
85             (DeferredDocumentImpl) this.ownerDocument();
86         target = ownerDocument.getNodeName(fNodeIndex);
87         data = ownerDocument.getNodeValueString(fNodeIndex);
88
89     } // synchronizeData()
90

91 } // class DeferredProcessingInstructionImpl
92
Popular Tags