Text


Text org.w3c.dom

Java 1.4

A Text node represents a run of plain text that does not contain any XML markup. Plain text appears within XML elements and attributes, and Text nodes typically appear as children of Element and Attr nodes. Text nodes inherit from CharacterData , and the textual content of a Text node is available through the getdata( ) method inherited from CharacterData or through the getNodeValue( ) method inherited from Node .

Text nodes may be manipulated using any of the methods inherited from CharacterData . The Text interface defines one method of its own: splitText( ) splits a Text node at the specified character position. The method changes the original node so that it contains only the text up to the specified position. Then it creates a new Text node that contains the text from the specified position on and inserts that new node into the document tree immediately after the original one. The Node.normalize( ) method reverses this process by deleting emty Text nodes and merging adjacent Text nodes into a single node.

Text nodes never have children.

Figure 21-14. org.w3c.dom.Text

 public interface  Text  extends CharacterData {  // Public Instance Methods   5.0  String  getWholeText  ( );  5.0  boolean  isElementContentWhitespace  ( );  5.0  Text  replaceWholeText  (String  content  ) throws DOMException;        Text  splitText  (int  offset  ) throws DOMException;   } 

Implementations

CDATASection

Returned By

Document.createTextNode( )



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net