2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
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.
18
package org.apache.xerces.dom;
21
* Text nodes hold the non-markup, non-Entity content of
22
* an Element or Attribute.
24
* When a document is first made available to the DOM, there is only
25
* one Text object for each block of adjacent plain-text. Users (ie,
26
* applications) may create multiple adjacent Texts during editing --
27
* see {@link org.w3c.dom.Element#normalize} for discussion.
29
* Note that CDATASection is a subclass of Text. This is conceptually
30
* valid, since they're really just two different ways of quoting
31
* characters when they're written out as part of an XML stream.
35
* @version $Id: DeferredTextImpl.java,v 1.2 2009/12/10 03:18:32 matthewoliver Exp $
36
* @since PR-DOM-Level-1-19980818.
38
public class DeferredTextImpl
40
implements DeferredNode {
46
/** Serialization version. */
47
static final long serialVersionUID = 2310613872100393425L;
54
protected transient int fNodeIndex;
61
* This is the deferred constructor. Only the fNodeIndex is given here.
62
* All other data, can be requested from the ownerDocument via the index.
64
DeferredTextImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) {
65
super(ownerDocument, null);
67
fNodeIndex = nodeIndex;
70
} // <init>(DeferredDocumentImpl,int)
73
// DeferredNode methods
76
/** Returns the node index. */
77
public int getNodeIndex() {
85
/** Synchronizes the underlying data. */
86
protected void synchronizeData() {
88
// no need for future synchronizations
91
// get initial text value
92
DeferredDocumentImpl ownerDocument =
93
(DeferredDocumentImpl) this.ownerDocument();
94
data = ownerDocument.getNodeValueString(fNodeIndex);
96
// NOTE: We used to normalize adjacent text node values here.
97
// This code has moved to the DeferredDocumentImpl
98
// getNodeValueString() method. -Ac
100
// ignorable whitespace
101
isIgnorableWhitespace(ownerDocument.getNodeExtra(fNodeIndex) == 1);
103
} // synchronizeData()
105
} // class DeferredTextImpl