~vcs-imports/xena/trunk

« back to all changes in this revision

Viewing changes to ext/src/xerces-2_9_1/src/org/apache/xerces/dom/DeferredTextImpl.java

  • Committer: matthewoliver
  • Date: 2009-12-10 03:18:07 UTC
  • Revision ID: vcs-imports@canonical.com-20091210031807-l086qguzdlljtkl9
Merged Xena Testing into Xena Stable for the Xena 5 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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
 
8
 * 
 
9
 *      http://www.apache.org/licenses/LICENSE-2.0
 
10
 * 
 
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.
 
16
 */
 
17
 
 
18
package org.apache.xerces.dom;
 
19
 
 
20
/**
 
21
 * Text nodes hold the non-markup, non-Entity content of
 
22
 * an Element or Attribute.
 
23
 * <P>
 
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.
 
28
 * <P>
 
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.
 
32
 * 
 
33
 * @xerces.internal
 
34
 *
 
35
 * @version $Id: DeferredTextImpl.java,v 1.2 2009/12/10 03:18:32 matthewoliver Exp $
 
36
 * @since  PR-DOM-Level-1-19980818.
 
37
 */
 
38
public class DeferredTextImpl
 
39
    extends TextImpl
 
40
    implements DeferredNode {
 
41
 
 
42
    //
 
43
    // Constants
 
44
    //
 
45
 
 
46
    /** Serialization version. */
 
47
    static final long serialVersionUID = 2310613872100393425L;
 
48
 
 
49
    //
 
50
    // Data
 
51
    //
 
52
 
 
53
    /** Node index. */
 
54
    protected transient int fNodeIndex;
 
55
 
 
56
    //
 
57
    // Constructors
 
58
    //
 
59
 
 
60
    /**
 
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.
 
63
     */
 
64
    DeferredTextImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) {
 
65
        super(ownerDocument, null);
 
66
 
 
67
        fNodeIndex = nodeIndex;
 
68
        needsSyncData(true);
 
69
 
 
70
    } // <init>(DeferredDocumentImpl,int)
 
71
 
 
72
    //
 
73
    // DeferredNode methods
 
74
    //
 
75
 
 
76
    /** Returns the node index. */
 
77
    public int getNodeIndex() {
 
78
        return fNodeIndex;
 
79
    }
 
80
 
 
81
    //
 
82
    // Protected methods
 
83
    //
 
84
 
 
85
    /** Synchronizes the underlying data. */
 
86
    protected void synchronizeData() {
 
87
 
 
88
        // no need for future synchronizations
 
89
        needsSyncData(false);
 
90
 
 
91
        // get initial text value
 
92
        DeferredDocumentImpl ownerDocument =
 
93
            (DeferredDocumentImpl) this.ownerDocument();
 
94
        data = ownerDocument.getNodeValueString(fNodeIndex);
 
95
 
 
96
        // NOTE: We used to normalize adjacent text node values here.
 
97
        //       This code has moved to the DeferredDocumentImpl
 
98
        //       getNodeValueString() method. -Ac
 
99
 
 
100
        // ignorable whitespace
 
101
        isIgnorableWhitespace(ownerDocument.getNodeExtra(fNodeIndex) == 1);
 
102
 
 
103
    } // synchronizeData()
 
104
 
 
105
} // class DeferredTextImpl