KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Notations are how the Document Type Description (DTD) records hints
21  * about the format of an XML "unparsed entity" -- in other words,
22  * non-XML data bound to this document type, which some applications
23  * may wish to consult when manipulating the document. A Notation
24  * represents a name-value pair, with its nodeName being set to the
25  * declared name of the notation.
26  * <P>
27  * Notations are also used to formally declare the "targets" of
28  * Processing Instructions.
29  * <P>
30  * Note that the Notation's data is non-DOM information; the DOM only
31  * records what and where it is.
32  * <P>
33  * See the XML 1.0 spec, sections 4.7 and 2.6, for more info.
34  * <P>
35  * Level 1 of the DOM does not support editing Notation contents.
36  *
37  * @xerces.internal
38  *
39  * @version $Id: DeferredNotationImpl.java,v 1.12 2004/10/05 17:12:49 mrglavas Exp $
40  * @since PR-DOM-Level-1-19980818.
41  */

42 public class DeferredNotationImpl
43     extends NotationImpl
44     implements DeferredNode {
45
46     //
47
// Constants
48
//
49

50     /** Serialization version. */
51     static final long serialVersionUID = 5705337172887990848L;
52
53     //
54
// Data
55
//
56

57     /** Node index. */
58     protected transient int fNodeIndex;
59
60     //
61
// Constructors
62
//
63

64     /**
65      * This is the deferred constructor. Only the fNodeIndex is given here.
66      * All other data, can be requested from the ownerDocument via the index.
67      */

68     DeferredNotationImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) {
69         super(ownerDocument, null);
70
71         fNodeIndex = nodeIndex;
72         needsSyncData(true);
73
74     } // <init>(DeferredDocumentImpl,int)
75

76     //
77
// DeferredNode methods
78
//
79

80     /** Returns the node index. */
81     public int getNodeIndex() {
82         return fNodeIndex;
83     }
84
85     //
86
// Protected methods
87
//
88

89     /**
90      * Synchronizes the data. This is special because of the way
91      * that the "fast" notation stores its information internally.
92      */

93     protected void synchronizeData() {
94
95         // no need to synchronize again
96
needsSyncData(false);
97
98         // name
99
DeferredDocumentImpl ownerDocument =
100             (DeferredDocumentImpl)this.ownerDocument();
101         name = ownerDocument.getNodeName(fNodeIndex);
102
103         ownerDocument.getNodeType(fNodeIndex);
104         // public and system ids
105
publicId = ownerDocument.getNodeValue(fNodeIndex);
106         systemId = ownerDocument.getNodeURI(fNodeIndex);
107         int extraDataIndex = ownerDocument.getNodeExtra(fNodeIndex);
108         ownerDocument.getNodeType(extraDataIndex);
109         baseURI = ownerDocument.getNodeName(extraDataIndex);
110
111
112     } // synchronizeData()
113

114 } // class DeferredNotationImpl
115
Popular Tags