Package org.apache.xpath.objects

Examples of org.apache.xpath.objects.XObject.nodelist()


        final String pathString = getXPathString();
        try {
            XObject xObject = XPathAPI.eval(doc, pathString);
            switch (xObject.getType()) {
                case XObject.CLASS_NODESET:
                    nodeList = xObject.nodelist();
                    break;
                case XObject.CLASS_BOOLEAN:
                    if (!xObject.bool()){
                        result.setFailure(!isNegated());
                        result.setFailureMessage("No Nodes Matched " + pathString);
View Full Code Here


      // Execute the XPath, and have it return the result
      XObject list = eval(contextNode, xpathnode, namespaceNode);

      // Return a NodeList.
      return list.nodelist();
   }

   /**
    *  Evaluate XPath string to an XObject.  Using this method,
    *  XPath namespace prefixes will be resolved from the namespaceNode.
View Full Code Here

      // Execute the XPath, and have it return the result
      XObject list = eval(contextNode, xpathnode, namespaceNode);

      // Return a NodeList.
      return list.nodelist();
   }

   /**
    *  Evaluate XPath string to an XObject.  Using this method,
    *  XPath namespace prefixes will be resolved from the namespaceNode.
View Full Code Here

    public NodeList selectNodeList(Node contextNode, String str, PrefixResolver resolver)
    {
        try
        {
            final XObject result = XPathAPI.eval( contextNode, str, new XalanResolver(resolver, m_baseURI) );
            return result.nodelist();
        }
        catch( final TransformerException e )
        {
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Failed to evaluate '" + str + "'", e);
View Full Code Here

     throws TransformerException
    {
        String val = null;
       XObject xObject = XPathAPI.eval(d, query);
        if (xObject.getType() == XObject.CLASS_NODESET) {
          NodeList matches = xObject.nodelist();
      int length = matches.getLength();
          vars.put(concat(refName,MATCH_NR), String.valueOf(length));
          for (int i = 0 ; i < length; i++) {
              Node match = matches.item(i);
        if ( match instanceof Element){
View Full Code Here

        //
        // if the xpath resolves to a set of nodes, return them
        //
        if (type == XObject.CLASS_NODESET)
        {
            NodeList list = result.nodelist();
            return XmlUtils.convertToArray(list);
        }
       
        //
        // otherwise, it's a scalar - turn it into a text node
View Full Code Here

      if (x == null || x instanceof XNull) {
        return null;
      } else if (XObject.CLASS_BOOLEAN == x.getType() || x instanceof XBoolean) {
        return Boolean.valueOf(x.bool());
      } else if (XObject.CLASS_NODESET == x.getType() || x instanceof XNodeSet || x instanceof NodeSequence) {
        return x.nodelist();
      } else if (XObject.CLASS_NUMBER == x.getType() || x instanceof XNumber) {
        return new java.math.BigDecimal(x.str());
      } else if (XObject.CLASS_UNRESOLVEDVARIABLE == x.getType()) {
        return new java.math.BigDecimal(x.str());
      } else if (XObject.CLASS_RTREEFRAG == x.getType()) {
View Full Code Here

    final String pathString = getXPathString();
    try {
      XObject xObject = XPathAPI.eval(doc, pathString);
      switch (xObject.getType()) {
        case XObject.CLASS_NODESET:
          nodeList = xObject.nodelist();
          break;
        case XObject.CLASS_BOOLEAN:
          if (!xObject.bool()){
            result.setFailure(!isNegated());
            result.setFailureMessage("No Nodes Matched " + pathString);
View Full Code Here

     throws TransformerException
    {
        String val = null;
       XObject xObject = XPathAPI.eval(d, query);
        if (xObject.getType() == XObject.CLASS_NODESET) {
          NodeList matches = xObject.nodelist();
      int length = matches.getLength();
          vars.put(concat(refName,MATCH_NR), String.valueOf(length));
          for (int i = 0 ; i < length; i++) {
              Node match = matches.item(i);
        if ( match instanceof Element){
View Full Code Here

        // Execute the XPath, and have it return the result
        XObject list = eval(contextNode, xpathnode, str, namespaceNode);

        // Return a NodeList.
        return list.nodelist();
    }
   
    /**
     * Evaluate an XPath string and return true if the output is to be included or not.
     *  @param contextNode The node to start searching from.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.