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 * Text nodes hold the non-markup, non-Entity content of 26 * an Element or Attribute. 27 * <P> 28 * When a document is first made available to the DOM, there is only 29 * one Text object for each block of adjacent plain-text. Users (ie, 30 * applications) may create multiple adjacent Texts during editing -- 31 * see {@link org.w3c.dom.Element#normalize} for discussion. 32 * <P> 33 * Note that CDATASection is a subclass of Text. This is conceptually 34 * valid, since they're really just two different ways of quoting 35 * characters when they're written out as part of an XML stream. 36 * 37 * @xerces.internal 38 * 39 * @since PR-DOM-Level-1-19980818. 40 */ 41public class DeferredTextImpl 42 extends TextImpl 43 implements DeferredNode { 44 45 // 46 // Constants 47 // 48 49 /** Serialization version. */ 50 static final long serialVersionUID = 2310613872100393425L; 51 52 // 53 // Data 54 // 55 56 /** Node index. */ 57 protected transient int fNodeIndex; 58 59 // 60 // Constructors 61 // 62 63 /** 64 * This is the deferred constructor. Only the fNodeIndex is given here. 65 * All other data, can be requested from the ownerDocument via the index. 66 */ 67 DeferredTextImpl(DeferredDocumentImpl ownerDocument, int nodeIndex) { 68 super(ownerDocument, null); 69 70 fNodeIndex = nodeIndex; 71 needsSyncData(true); 72 73 } // <init>(DeferredDocumentImpl,int) 74 75 // 76 // DeferredNode methods 77 // 78 79 /** Returns the node index. */ 80 public int getNodeIndex() { 81 return fNodeIndex; 82 } 83 84 // 85 // Protected methods 86 // 87 88 /** Synchronizes the underlying data. */ 89 protected void synchronizeData() { 90 91 // no need for future synchronizations 92 needsSyncData(false); 93 94 // get initial text value 95 DeferredDocumentImpl ownerDocument = 96 (DeferredDocumentImpl) this.ownerDocument(); 97 data = ownerDocument.getNodeValueString(fNodeIndex); 98 99 // NOTE: We used to normalize adjacent text node values here. 100 // This code has moved to the DeferredDocumentImpl 101 // getNodeValueString() method. -Ac 102 103 // ignorable whitespace 104 isIgnorableWhitespace(ownerDocument.getNodeExtra(fNodeIndex) == 1); 105 106 } // synchronizeData() 107 108} // class DeferredTextImpl 109