Examples of CachedXPathAPI


Examples of org.apache.xpath.CachedXPathAPI

            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            DocumentBuilder dbuilder = factory.newDocumentBuilder();
            Document doc = dbuilder.parse(inputSource);

            CachedXPathAPI cachedXPathAPI = new CachedXPathAPI();
            NodeIterator iterator = cachedXPathAPI.selectNodeIterator(doc, xpath);
            return iterator.nextNode() != null;

        } catch (Throwable e) {
            return false;
        }
View Full Code Here

Examples of org.apache.xpath.CachedXPathAPI

            Document doc = dbuilder.parse(inputSource);

            // We should associated the cachedXPathAPI object with the message
            // being evaluated
            // since that should speedup subsequent xpath expressions.
            CachedXPathAPI cachedXPathAPI = new CachedXPathAPI();
            NodeIterator iterator = cachedXPathAPI.selectNodeIterator(doc, xpath);
            return iterator.nextNode() != null;
        } catch (Throwable e) {
            return false;
        }
    }
View Full Code Here

Examples of org.apache.xpath.CachedXPathAPI

      String s1 =
         "<!--Small Comment Test--><RootElement><Element1/><Element2/><Element3>Text in Element3</Element3></RootElement>";

      XMLUtils.circumventBug2650(doc);

      CachedXPathAPI cXPathAPI = new CachedXPathAPI();
      NodeList nl = cXPathAPI.selectNodeList(doc,
                                             "(//. | //@* | //namespace::*)");

      return XMLUtils.convertNodelistToSet(nl);
   }
View Full Code Here

Examples of org.apache.xpath.CachedXPathAPI

         + "self::ietf:e1 or "
         + "(parent::ietf:e1 and not(self::text() or self::e2)) or "
         + "count(id(\"E3\")|ancestor-or-self::node()) = count(ancestor-or-self::node()) "
         + "]";
      //J+
      CachedXPathAPI xpathAPI = new CachedXPathAPI();

      XMLUtils.circumventBug2650(doc);

      NodeList nodes = xpathAPI.selectNodeList(doc, xpath, nscontext);
      Canonicalizer c14n =
         Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
      byte c14nBytes[] = c14n.canonicalizeXPathNodeSet(nodes);
      InputStream refStream = resolver.resolveEntity(null,
                                 fileRef).getByteStream();
View Full Code Here

Examples of org.apache.xpath.CachedXPathAPI

         .IgnoreAllErrorHandler());

      Document doc = db.parse(new ByteArrayInputStream(input.getBytes()));
      Canonicalizer c14nizer =
         Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
      CachedXPathAPI xpathAPI = new CachedXPathAPI();

      XMLUtils.circumventBug2650(doc);

      NodeList nodes =
         xpathAPI.selectNodeList(doc, "(//*[local-name()='included'] | //@*[parent::node()[local-name()='included']])");
      byte result[] = c14nizer.canonicalizeXPathNodeSet(nodes);
      byte defined[] = definedOutput.getBytes();

      if (writeResultsToFile) {
         File fileD = new File("defined.txt");
View Full Code Here

Examples of org.apache.xpath.CachedXPathAPI

      byte c14nBytes[] = null;

      if (xpath == null) {
         c14nBytes = c14n.canonicalizeSubtree(doc);
      } else {
         CachedXPathAPI xpathAPI = new CachedXPathAPI();
         NodeList nl = null;

         if (xpath instanceof String) {
            nl = xpathAPI.selectNodeList(doc, (String) xpath);
         } else {
            Element xpathElement = (Element) xpath;
            String xpathStr = ((Text) xpathElement.getFirstChild()).getData();

            nl = xpathAPI.selectNodeList(doc, xpathStr, xpathElement);
         }

         c14nBytes = c14n.canonicalizeXPathNodeSet(nl);
      }
View Full Code Here

Examples of org.apache.xpath.CachedXPathAPI

      byte c14nBytes[] = null;

      if (xpath == null) {
         c14nBytes = c14n.canonicalizeSubtree(doc);
      } else {
         CachedXPathAPI xpathAPI = new CachedXPathAPI();
         NodeList nl = null;

         if (xpath instanceof String) {
            nl = xpathAPI.selectNodeList(doc, (String) xpath);
         } else {
            Element xpathElement = (Element) xpath;
            String xpathStr = ((Text) xpathElement.getFirstChild()).getData();

            nl = xpathAPI.selectNodeList(doc, xpathStr, xpathElement);
         }

         c14nBytes = c14n.canonicalizeXPathNodeSet(nl);
      }
View Full Code Here

Examples of org.apache.xpath.CachedXPathAPI

         .IgnoreAllErrorHandler());

      Document doc = db.parse(new ByteArrayInputStream(input.getBytes()));
      Canonicalizer c14nizer =
         Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
      CachedXPathAPI xpathAPI = new CachedXPathAPI();
      XMLUtils.circumventBug2650(doc);
      NodeList nodes =
         xpathAPI.selectNodeList(doc, "(//*[local-name()='included'] | //@*)");
      byte result[] = c14nizer.canonicalizeXPathNodeSet(nodes);
      byte defined[] = definedOutput.getBytes();

      if (writeResultsToFile) {
         File fileD = new File("defined.txt");
View Full Code Here

Examples of org.apache.xpath.CachedXPathAPI

      byte[] copy = new byte[inputOctets.length];

      System.arraycopy(inputOctets, 0, copy, 0, inputOctets.length);

      this._inputOctetStreamProxy = new ByteArrayInputStream(copy);
      this._cxpathAPI = new CachedXPathAPI();
   }
View Full Code Here

Examples of org.apache.xpath.CachedXPathAPI

    *
    * @param rootNode
    * @throws TransformerException
    */
   public XMLSignatureInput(Node rootNode) throws TransformerException {
      this(rootNode, new CachedXPathAPI());
   }
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.