01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.xerces.dom;
19:
20: /**
21: * Processing Instructions (PIs) permit documents to carry
22: * processor-specific information alongside their actual content. PIs
23: * are most common in XML, but they are supported in HTML as well.
24: *
25: * @xerces.internal
26: *
27: * @version $Id: DeferredProcessingInstructionImpl.java 447266 2006-09-18 05:57:49Z mrglavas $
28: * @since PR-DOM-Level-1-19980818.
29: */
30: public class DeferredProcessingInstructionImpl extends
31: ProcessingInstructionImpl 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(
56: DeferredDocumentImpl ownerDocument, 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 = (DeferredDocumentImpl) this
85: .ownerDocument();
86: target = ownerDocument.getNodeName(fNodeIndex);
87: data = ownerDocument.getNodeValueString(fNodeIndex);
88:
89: } // synchronizeData()
90:
91: } // class DeferredProcessingInstructionImpl
|