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