public void Text(String text) throws Exception { String result = ""; if (this._NodeType == null) { throw new Exception("Must set NodeType before setting Text."); } String type = this._NodeType.toString(); if (type.equals("text") || type.equals("attribute")) { this.NodeValue(text); } else { DOMNode child = new DOMNode(); child._NodeType = new DOMNodeType("text"); child.Text(text); this.AppendChild(child); } }
// contains the text content of the node and its subtrees. [read/write] public String Text() { String result = ""; String type = this._NodeType.toString(); if (type.equals("text") || type.equals("attribute")) { result = this.NodeValue().toString(); } else { Collection children = _ChildNodes.Items(); Iterator it = children.iterator(); while (it.hasNext()) { // check for a text child DOMNode child = (DOMNode) it.next(); result = result + child.Text(); } } return result; }