/**
  * Convert a sequence of values to a NODELIST, as defined in the JAXP XPath API spec. This method
  * is used when the evaluate() request specifies the return type as NODELIST, regardless of the
  * actual results of the expression. If the sequence contains things other than nodes, the
  * fallback is to return the sequence as a Java List object. The method can return null to invoke
  * fallback behaviour.
  */
 public Object convertToNodeList(SequenceExtent extent) {
   try {
     NodeList nodeList = DOMNodeList.checkAndMake(extent);
     return nodeList;
   } catch (XPathException e) {
     return null;
   }
 }
Exemple #2
0
  public static void build(State s) {
    DOMNodeList.build(s);
    DOMNode.build(s);
    DOMAttr.build(s);
    DOMNamedNodeMap.build(s);
    DOMDocumentType.build(s);
    DOMException.build(s);
    DOMElement.build(s);
    DOMCharacterData.build(s);
    DOMText.build(s);
    DOMConfiguration.build(s);
    DOMNotation.build(s);
    DOMCDataSection.build(s);
    DOMComment.build(s);
    DOMEntity.build(s);
    DOMEntityReference.build(s);
    DOMProcessingInstruction.build(s);
    DOMStringList.build(s);
    DOMDocumentFragment.build(s);

    // Document
    DOMDocument.build(s);
    DOMImplementation.build(s);

    // Set the remaining properties on DOMNode, due to circularity, and
    // summarize.
    createDOMProperty(
        s,
        DOMNode.PROTOTYPE,
        "attributes",
        Value.makeObject(
            DOMNamedNodeMap.INSTANCES, new Dependency(), new DependencyGraphReference()),
        DOMSpec.LEVEL_1);
    createDOMProperty(
        s,
        DOMNode.PROTOTYPE,
        "ownerDocument",
        Value.makeObject(DOMDocument.INSTANCES, new Dependency(), new DependencyGraphReference()),
        DOMSpec.LEVEL_1);
    s.multiplyObject(DOMNode.INSTANCES);
    DOMNode.INSTANCES = DOMNode.INSTANCES.makeSingleton().makeSummary();
  }
Exemple #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;
  }