Package javax.xml.xpath

Examples of javax.xml.xpath.XPathExpression.evaluate()


        // Signature Algorithm
        final XPathExpression sigAlgoExpr =
            xpath.compile("/s:Envelope/s:Header/wsse:Security/ds:Signature/ds:SignedInfo"
                              + "/ds:SignatureMethod/@Algorithm");
       
        final String sigMethod =  (String) sigAlgoExpr.evaluate(signedDoc, XPathConstants.STRING);
        assertEquals(expectedSignatureMethod, sigMethod);
       
        // Digest Method Algorithm
        final XPathExpression digestAlgoExpr = xpath.compile(
            "/s:Envelope/s:Header/wsse:Security/ds:Signature/ds:SignedInfo/ds:Reference/ds:DigestMethod");
View Full Code Here


        // Digest Method Algorithm
        final XPathExpression digestAlgoExpr = xpath.compile(
            "/s:Envelope/s:Header/wsse:Security/ds:Signature/ds:SignedInfo/ds:Reference/ds:DigestMethod");
       
        final NodeList digestMethodNodes =
            (NodeList) digestAlgoExpr.evaluate(signedDoc, XPathConstants.NODESET);
       
        for (int i = 0; i < digestMethodNodes.getLength(); i++) {
            Node node = (Node)digestMethodNodes.item(i);
            String digestAlgorithm = node.getAttributes().getNamedItem("Algorithm").getNodeValue();
            assertEquals(expectedDigestAlgorithm, digestAlgorithm);
View Full Code Here

       
        // Canonicalization Algorithm
        final XPathExpression canonAlgoExpr =
            xpath.compile("/s:Envelope/s:Header/wsse:Security/ds:Signature/ds:SignedInfo"
                              + "/ds:CanonicalizationMethod/@Algorithm");
        final String canonMethod =  (String) canonAlgoExpr.evaluate(signedDoc, XPathConstants.STRING);
        assertEquals(expectedCanonAlgorithm, canonMethod);
    }
   
    // TODO: This method can be removed when runOutInterceptorAndValidateSamlTokenAttached
    // is cleaned up.
View Full Code Here

        // Find the SecurityTokenReference for the assertion
        final XPathExpression strExpr = xpath.compile(
            "/s:Envelope/s:Header/wsse:Security/wsse:SecurityTokenReference/wsse:KeyIdentifier");
       
        final NodeList strKeyIdNodes =
            (NodeList) strExpr.evaluate(signedDoc, XPathConstants.NODESET);
       
        String strId = null;
        for (int i = 0; i < strKeyIdNodes.getLength(); i++) {
            Node keyIdNode = (Node) strKeyIdNodes.item(i);
            String strKey = keyIdNode.getTextContent();
View Full Code Here

        // Verify STR is included in the signature references
        final XPathExpression sigRefExpr = xpath.compile(
            "/s:Envelope/s:Header/wsse:Security/ds:Signature/ds:SignedInfo/ds:Reference");
       
        final NodeList sigReferenceNodes =
            (NodeList) sigRefExpr.evaluate(signedDoc, XPathConstants.NODESET);
       
        boolean foundStrReference = false;
        for (int i = 0; i < sigReferenceNodes.getLength(); i++) {
            Node sigRefNode = (Node) sigReferenceNodes.item(i);
            String sigRefURI = sigRefNode.getAttributes().getNamedItem("URI").getNodeValue();
View Full Code Here

                    for (XmlSchema schema : schemas.getXmlSchemas()) {
                        if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(schema.getTargetNamespace())) {
                            continue;
                        }
                        Object src = getSchemaNode(schema, schemas);
                        NodeList nodes = (NodeList)xpe.evaluate(src, XPathConstants.NODESET);
                        if (nodes.getLength() > 0) {
                            String key = schema.getSourceURI();
                            binding = convertToTmpInputSource(d.getDocumentElement(), key);
                            opts.addBindFile(binding);
                            binding = null;
View Full Code Here

      // and save result nodes in queryList
      for (int j = 0; j < this.xpathList.size(); j++) {
        XPathFactory factory = XPathFactory.newInstance();
        XPath xpath = factory.newXPath();
        XPathExpression expr = xpath.compile(this.xpathList.get(j));
        Object results = expr.evaluate(doc, XPathConstants.NODESET);
        NodeList nodes = (NodeList) results;
        queryList.add(nodes);
      }

      List<List<Triple>> result = new ArrayList<List<Triple>>();
View Full Code Here

    }

    private static void addAlwaysApplicablePolicySets(PolicySet policySet,
                                                      Document doc) throws XPathExpressionException {
        XPathExpression expression = policySet.getAlwaysAppliesToXPathExpression();
        NodeList result = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);

        if (result != null) {
            for (int counter = 0; counter < result.getLength(); ++counter) {
                Node aResultNode = result.item(counter);
View Full Code Here

    }

    private static void addApplicablePolicySets(PolicySet policySet,
                                         Document doc) throws XPathExpressionException {
        XPathExpression expression = policySet.getAppliesToXPathExpression();
        NodeList result = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);

        if (result != null) {
            for (int counter = 0; counter < result.getLength(); ++counter) {
                Node aResultNode = result.item(counter);
View Full Code Here

   */
  public IterableElementList xpath(Node doc, String query) throws XPathExpressionException {
    XPathFactory factory = XPathFactory.newInstance();
    XPath xpath = factory.newXPath();
    XPathExpression expr = xpath.compile(query);
    NodeList result = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
    return new IterableElementList(result);
  }
 
  /**
   * Get the first node result from an XPath query.
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.