caucho
Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial

Getting Started
Configuration
Servlet
JSP
XTP/XSL
JavaScript
JS Library

Core Library
File Library
Servlet Library
Database Library
XML Library

Parser
XQL
XSL
Document
Node
Element
Text
Comment
EntityRef
CData
PI
 XML Text

Text inherits from Node.

Text
nodeName Returns '#text'
nodeType Returns TEXT_NODE
nodeValue Returns the text data.
data Returns the text data.
length Returns the length of the text.
substringData(offset, count) Returns a count character substring starting at offset
appendData(data) Appends data to the text.
insertData(offset, data) Inserts data to the text.
deleteData(offset, count) Deletes a range of data from the text.
replaceData(offset, count, data) Replaces the range with new data.
splitText(offset) Splits the text into two sibling nodes, returning the second.

Text DOM 1.0

nodeName

Returns '#text'

nodeType

Returns TEXT_NODE

nodeValue

Returns the text data.

data

Returns the text data.

length

Returns the length of the text.

substringData(offset, count)

Returns a count character substring starting at offset

xml = caucho.xml.Xml.parseString('<a>123456</a>');

elt = xml.documentElement
text = elt.firstChild

writeln(text.substringData(2, 3))
345

appendData(data)

Appends data to the text.

xml = caucho.xml.Xml.parseString('<a>123456</a>');

elt = xml.documentElement
text = elt.firstChild

text.appendData("freezow");

writeln(text);
123456freezow

insertData(offset, data)

Inserts data to the text.

xml = caucho.xml.Xml.parseString('<a>123456</a>');

elt = xml.documentElement
text = elt.firstChild

text.insertData(1, "freezow");

writeln(text);
1freezow23456

deleteData(offset, count)

Deletes a range of data from the text.

xml = caucho.xml.Xml.parseString('<a>123456</a>');

elt = xml.documentElement
text = elt.firstChild

text.deleteData(1, 2, "new");

writeln(text);
1456

replaceData(offset, count, data)

Replaces the range with new data.

xml = caucho.xml.Xml.parseString('<a>123456</a>');

elt = xml.documentElement
text = elt.firstChild

text.replaceData(1, 2, "new");

writeln(text);
1new456

splitText(offset)

Splits the text into two sibling nodes, returning the second.

xml = caucho.xml.Xml.parseString('<a>1234</a>');

elt = xml.documentElement
text = elt.firstChild

newText = text.splitText(2);
newText.insertData(0, "foo")

writeln(newText.data)
xml.print(out)
foo34
<a>12foo34</a>

Element   Comment
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Fri, 31 Mar 2000 18:57:59 -0800 (PST)