1. /*
  2. * Copyright (c) 2000 World Wide Web Consortium,
  3. * (Massachusetts Institute of Technology, Institut National de
  4. * Recherche en Informatique et en Automatique, Keio University). All
  5. * Rights Reserved. This program is distributed under the W3C's Software
  6. * Intellectual Property License. This program is distributed in the
  7. * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  8. * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  9. * PURPOSE.
  10. * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  11. */
  12. package org.w3c.dom;
  13. /**
  14. * The <code>Text</code> interface inherits from <code>CharacterData</code>
  15. * and represents the textual content (termed character data in XML) of an
  16. * <code>Element</code> or <code>Attr</code>. If there is no markup inside
  17. * an element's content, the text is contained in a single object
  18. * implementing the <code>Text</code> interface that is the only child of
  19. * the element. If there is markup, it is parsed into the information items
  20. * (elements, comments, etc.) and <code>Text</code> nodes that form the list
  21. * of children of the element.
  22. * <p>When a document is first made available via the DOM, there is only one
  23. * <code>Text</code> node for each block of text. Users may create adjacent
  24. * <code>Text</code> nodes that represent the contents of a given element
  25. * without any intervening markup, but should be aware that there is no way
  26. * to represent the separations between these nodes in XML or HTML, so they
  27. * will not (in general) persist between DOM editing sessions. The
  28. * <code>normalize()</code> method on <code>Node</code> merges any such
  29. * adjacent <code>Text</code> objects into a single node for each block of
  30. * text.
  31. * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
  32. */
  33. public interface Text extends CharacterData {
  34. /**
  35. * Breaks this node into two nodes at the specified <code>offset</code>,
  36. * keeping both in the tree as siblings. After being split, this node
  37. * will contain all the content up to the <code>offset</code> point. A
  38. * new node of the same type, which contains all the content at and
  39. * after the <code>offset</code> point, is returned. If the original
  40. * node had a parent node, the new node is inserted as the next sibling
  41. * of the original node. When the <code>offset</code> is equal to the
  42. * length of this node, the new node has no data.
  43. * @param offset The 16-bit unit offset at which to split, starting from
  44. * <code>0</code>.
  45. * @return The new node, of the same type as this node.
  46. * @exception DOMException
  47. * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
  48. * than the number of 16-bit units in <code>data</code>.
  49. * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
  50. */
  51. public Text splitText(int offset)
  52. throws DOMException;
  53. }