jaxp/src/share/classes/org/w3c/dom/CharacterData.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 6 7f561c08de6b
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * published by the Free Software Foundation.  Sun designates this
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * by Sun in the LICENSE file that accompanied this code.
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * accompanied this code).
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 * CA 95054 USA or visit www.sun.com if you need additional information or
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 * have any questions.
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
 * This file is available under and governed by the GNU General Public
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
 * License version 2 only, as published by the Free Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
 * However, the following notice accompanied the original version of this
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
 * file and, per its terms, should not be removed:
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 * Copyright (c) 2004 World Wide Web Consortium,
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 * (Massachusetts Institute of Technology, European Research Consortium for
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 * Informatics and Mathematics, Keio University). All Rights Reserved. This
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 * work is distributed under the W3C(r) Software License [1] in the hope that
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
package org.w3c.dom;
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 * The <code>CharacterData</code> interface extends Node with a set of
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
 * attributes and methods for accessing character data in the DOM. For
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
 * clarity this set is defined here rather than on each object that uses
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
 * these attributes and methods. No DOM objects correspond directly to
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
 * <code>CharacterData</code>, though <code>Text</code> and others do
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
 * inherit the interface from it. All <code>offsets</code> in this interface
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
 * start from <code>0</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
 * <p>As explained in the <code>DOMString</code> interface, text strings in
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
 * the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
 * the following, the term 16-bit units is used whenever necessary to
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
 * indicate that indexing on CharacterData is done in 16-bit units.
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
 * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
public interface CharacterData extends Node {
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
     * The character data of the node that implements this interface. The DOM
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
     * implementation may not put arbitrary limits on the amount of data
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
     * that may be stored in a <code>CharacterData</code> node. However,
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
     * implementation limits may mean that the entirety of a node's data may
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
     * not fit into a single <code>DOMString</code>. In such cases, the user
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
     * may call <code>substringData</code> to retrieve the data in
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
     * appropriately sized pieces.
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
     * @exception DOMException
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
     *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
     *   fit in a <code>DOMString</code> variable on the implementation
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
     *   platform.
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
    public String getData()
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
                            throws DOMException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
     * The character data of the node that implements this interface. The DOM
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
     * implementation may not put arbitrary limits on the amount of data
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
     * that may be stored in a <code>CharacterData</code> node. However,
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
     * implementation limits may mean that the entirety of a node's data may
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
     * not fit into a single <code>DOMString</code>. In such cases, the user
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
     * may call <code>substringData</code> to retrieve the data in
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
     * appropriately sized pieces.
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
     * @exception DOMException
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
     *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
    public void setData(String data)
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
                            throws DOMException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
     * The number of 16-bit units that are available through <code>data</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
     * and the <code>substringData</code> method below. This may have the
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
     * value zero, i.e., <code>CharacterData</code> nodes may be empty.
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
    public int getLength();
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
     * Extracts a range of data from the node.
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
     * @param offset Start offset of substring to extract.
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
     * @param count The number of 16-bit units to extract.
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
     * @return The specified substring. If the sum of <code>offset</code> and
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
     *   <code>count</code> exceeds the <code>length</code>, then all 16-bit
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
     *   units to the end of the data are returned.
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
     * @exception DOMException
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
     *   INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
     *   negative or greater than the number of 16-bit units in
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
     *   <code>data</code>, or if the specified <code>count</code> is
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
     *   negative.
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
     *   <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
     *   not fit into a <code>DOMString</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
    public String substringData(int offset,
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
                                int count)
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
                                throws DOMException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
     * Append the string to the end of the character data of the node. Upon
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
     * success, <code>data</code> provides access to the concatenation of
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
     * <code>data</code> and the <code>DOMString</code> specified.
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
     * @param arg The <code>DOMString</code> to append.
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
     * @exception DOMException
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
     *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
    public void appendData(String arg)
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
                           throws DOMException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
     * Insert a string at the specified 16-bit unit offset.
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
     * @param offset The character offset at which to insert.
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
     * @param arg The <code>DOMString</code> to insert.
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
     * @exception DOMException
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
     *   INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
     *   negative or greater than the number of 16-bit units in
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
     *   <code>data</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
     *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
    public void insertData(int offset,
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
                           String arg)
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
                           throws DOMException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
     * Remove a range of 16-bit units from the node. Upon success,
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
     * <code>data</code> and <code>length</code> reflect the change.
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
     * @param offset The offset from which to start removing.
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
     * @param count The number of 16-bit units to delete. If the sum of
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
     *   <code>offset</code> and <code>count</code> exceeds
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
     *   <code>length</code> then all 16-bit units from <code>offset</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
     *   to the end of the data are deleted.
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
     * @exception DOMException
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
     *   INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
     *   negative or greater than the number of 16-bit units in
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
     *   <code>data</code>, or if the specified <code>count</code> is
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
     *   negative.
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
     *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
    public void deleteData(int offset,
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
                           int count)
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
                           throws DOMException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
     * Replace the characters starting at the specified 16-bit unit offset
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
     * with the specified string.
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
     * @param offset The offset from which to start replacing.
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
     * @param count The number of 16-bit units to replace. If the sum of
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
     *   <code>offset</code> and <code>count</code> exceeds
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
     *   <code>length</code>, then all 16-bit units to the end of the data
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
     *   are replaced; (i.e., the effect is the same as a <code>remove</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
     *    method call with the same range, followed by an <code>append</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
     *    method invocation).
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
     * @param arg The <code>DOMString</code> with which the range must be
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
     *   replaced.
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
     * @exception DOMException
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
     *   INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
     *   negative or greater than the number of 16-bit units in
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
     *   <code>data</code>, or if the specified <code>count</code> is
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
     *   negative.
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
     *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
    public void replaceData(int offset,
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
                            int count,
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
                            String arg)
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
                            throws DOMException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
}