6
|
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 |
* Notations are how the Document Type Description (DTD) records hints
|
|
25 |
* about the format of an XML "unparsed entity" -- in other words,
|
|
26 |
* non-XML data bound to this document type, which some applications
|
|
27 |
* may wish to consult when manipulating the document. A Notation
|
|
28 |
* represents a name-value pair, with its nodeName being set to the
|
|
29 |
* declared name of the notation.
|
|
30 |
* <P>
|
|
31 |
* Notations are also used to formally declare the "targets" of
|
|
32 |
* Processing Instructions.
|
|
33 |
* <P>
|
|
34 |
* Note that the Notation's data is non-DOM information; the DOM only
|
|
35 |
* records what and where it is.
|
|
36 |
* <P>
|
|
37 |
* See the XML 1.0 spec, sections 4.7 and 2.6, for more info.
|
|
38 |
* <P>
|
|
39 |
* Level 1 of the DOM does not support editing Notation contents.
|
|
40 |
*
|
|
41 |
* @xerces.internal
|
|
42 |
*
|
|
43 |
* @since PR-DOM-Level-1-19980818.
|
|
44 |
*/
|
|
45 |
public class DeferredNotationImpl
|
|
46 |
extends NotationImpl
|
|
47 |
implements DeferredNode {
|
|
48 |
|
|
49 |
//
|
|
50 |
// Constants
|
|
51 |
//
|
|
52 |
|
|
53 |
/** Serialization version. */
|
|
54 |
static final long serialVersionUID = 5705337172887990848L;
|
|
55 |
|
|
56 |
//
|
|
57 |
// Data
|
|
58 |
//
|
|
59 |
|
|
60 |
/** Node index. */
|
|
61 |
protected transient int fNodeIndex;
|
|
62 |
|
|
63 |
//
|
|
64 |
// Constructors
|
|
65 |
//
|
|
66 |
|
|
67 |
/**
|
|
68 |
* This is the deferred constructor. Only the fNodeIndex is given here.
|
|
69 |
* All other data, can be requested from the ownerDocument via the index.
|
|
70 |
*/
|
|
71 |
DeferredNotationImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) {
|
|
72 |
super(ownerDocument, null);
|
|
73 |
|
|
74 |
fNodeIndex = nodeIndex;
|
|
75 |
needsSyncData(true);
|
|
76 |
|
|
77 |
} // <init>(DeferredDocumentImpl,int)
|
|
78 |
|
|
79 |
//
|
|
80 |
// DeferredNode methods
|
|
81 |
//
|
|
82 |
|
|
83 |
/** Returns the node index. */
|
|
84 |
public int getNodeIndex() {
|
|
85 |
return fNodeIndex;
|
|
86 |
}
|
|
87 |
|
|
88 |
//
|
|
89 |
// Protected methods
|
|
90 |
//
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Synchronizes the data. This is special because of the way
|
|
94 |
* that the "fast" notation stores its information internally.
|
|
95 |
*/
|
|
96 |
protected void synchronizeData() {
|
|
97 |
|
|
98 |
// no need to synchronize again
|
|
99 |
needsSyncData(false);
|
|
100 |
|
|
101 |
// name
|
|
102 |
DeferredDocumentImpl ownerDocument =
|
|
103 |
(DeferredDocumentImpl)this.ownerDocument();
|
|
104 |
name = ownerDocument.getNodeName(fNodeIndex);
|
|
105 |
|
|
106 |
ownerDocument.getNodeType(fNodeIndex);
|
|
107 |
// public and system ids
|
|
108 |
publicId = ownerDocument.getNodeValue(fNodeIndex);
|
|
109 |
systemId = ownerDocument.getNodeURI(fNodeIndex);
|
|
110 |
int extraDataIndex = ownerDocument.getNodeExtra(fNodeIndex);
|
|
111 |
ownerDocument.getNodeType(extraDataIndex);
|
|
112 |
baseURI = ownerDocument.getNodeName(extraDataIndex);
|
|
113 |
|
|
114 |
|
|
115 |
} // synchronizeData()
|
|
116 |
|
|
117 |
} // class DeferredNotationImpl
|