Example #1
0
  public DOMNode AppendChild(DOMNode node) {

    node._ParentNode = this;
    node._OwnerDocument = this._OwnerDocument;
    this._ChildNodes.AppendNode(node);

    return node;
  }
Example #2
0
  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);
    }
  }
Example #3
0
  // 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;
  }