001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.xerces.dom;
019:
020: /**
021: * Notations are how the Document Type Description (DTD) records hints
022: * about the format of an XML "unparsed entity" -- in other words,
023: * non-XML data bound to this document type, which some applications
024: * may wish to consult when manipulating the document. A Notation
025: * represents a name-value pair, with its nodeName being set to the
026: * declared name of the notation.
027: * <P>
028: * Notations are also used to formally declare the "targets" of
029: * Processing Instructions.
030: * <P>
031: * Note that the Notation's data is non-DOM information; the DOM only
032: * records what and where it is.
033: * <P>
034: * See the XML 1.0 spec, sections 4.7 and 2.6, for more info.
035: * <P>
036: * Level 1 of the DOM does not support editing Notation contents.
037: *
038: * @xerces.internal
039: *
040: * @version $Id: DeferredNotationImpl.java 447266 2006-09-18 05:57:49Z mrglavas $
041: * @since PR-DOM-Level-1-19980818.
042: */
043: public class DeferredNotationImpl extends NotationImpl implements
044: DeferredNode {
045:
046: //
047: // Constants
048: //
049:
050: /** Serialization version. */
051: static final long serialVersionUID = 5705337172887990848L;
052:
053: //
054: // Data
055: //
056:
057: /** Node index. */
058: protected transient int fNodeIndex;
059:
060: //
061: // Constructors
062: //
063:
064: /**
065: * This is the deferred constructor. Only the fNodeIndex is given here.
066: * All other data, can be requested from the ownerDocument via the index.
067: */
068: DeferredNotationImpl(DeferredDocumentImpl ownerDocument,
069: int nodeIndex) {
070: super (ownerDocument, null);
071:
072: fNodeIndex = nodeIndex;
073: needsSyncData(true);
074:
075: } // <init>(DeferredDocumentImpl,int)
076:
077: //
078: // DeferredNode methods
079: //
080:
081: /** Returns the node index. */
082: public int getNodeIndex() {
083: return fNodeIndex;
084: }
085:
086: //
087: // Protected methods
088: //
089:
090: /**
091: * Synchronizes the data. This is special because of the way
092: * that the "fast" notation stores its information internally.
093: */
094: protected void synchronizeData() {
095:
096: // no need to synchronize again
097: needsSyncData(false);
098:
099: // name
100: DeferredDocumentImpl ownerDocument = (DeferredDocumentImpl) this
101: .ownerDocument();
102: name = ownerDocument.getNodeName(fNodeIndex);
103:
104: ownerDocument.getNodeType(fNodeIndex);
105: // public and system ids
106: publicId = ownerDocument.getNodeValue(fNodeIndex);
107: systemId = ownerDocument.getNodeURI(fNodeIndex);
108: int extraDataIndex = ownerDocument.getNodeExtra(fNodeIndex);
109: ownerDocument.getNodeType(extraDataIndex);
110: baseURI = ownerDocument.getNodeName(extraDataIndex);
111:
112: } // synchronizeData()
113:
114: } // class DeferredNotationImpl
|