Package javax.xml.xpath

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


         {
            Node node = nodes.item(i);
            String name = (String)nameExp.evaluate(node, XPathConstants.STRING);
            String userAgentPattern = (String)userAgentPatternExp.evaluate(node, XPathConstants.STRING);
            String preferredMimeType = (String)preferredMimeTypeExp.evaluate(node, XPathConstants.STRING);
            String renderer = (String)rendererExp.evaluate(node, XPathConstants.STRING);
            HttpClientType clientInfo;
            if (renderer != null && renderer.length() > 0)
            {
               clientInfo = new HttpClientType(name, userAgentPattern, preferredMimeType, renderer);
            }
View Full Code Here


      try
      {
         Document doc = XMLTools.getDocumentBuilderFactory().newDocumentBuilder().parse(new ByteArrayInputStream(bytes));
        
         //
         NodeList nodes = (NodeList)expr.evaluate(doc, XPathConstants.NODESET);

         //
         for (int i = 0;i < nodes.getLength();i++)
         {
            Element urlPatternElt = (Element)nodes.item(i);
View Full Code Here

      Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder()
            .parse(new ByteArrayInputStream(descriptor.getBytes()));

      XPathExpression xPathExpression = XPathFactory.newInstance().newXPath().compile("/web-app/servlet/servlet-name");

      NodeList nodes = (NodeList) xPathExpression.evaluate(doc, XPathConstants.NODESET);

      List<String> servletNames = new ArrayList<String>();
      for (int i = 0; i < nodes.getLength(); i++)
      {
         Node node = nodes.item(i);
View Full Code Here

      try
      {
         Document doc = XMLTools.getDocumentBuilderFactory().newDocumentBuilder().parse(new ByteArrayInputStream(bytes));
        
         //
         NodeList nodes = (NodeList)expr.evaluate(doc, XPathConstants.NODESET);

         //
         for (int i = 0;i < nodes.getLength();i++)
         {
            Element urlPatternElt = (Element)nodes.item(i);
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

            }
            try {
                XPathFactory xpfactory = XPathFactory.newInstance();
                XPath xpath = xpfactory.newXPath();
                XPathExpression exp = xpath.compile(contentFilter.getContent().get(0).toString());
                Boolean ret = (Boolean) exp.evaluate(content, XPathConstants.BOOLEAN);
                return ret.booleanValue();
            } catch (XPathExpressionException e) {
                log.warn("Could not filter notification", e);
            }
            return false;
View Full Code Here

        // 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

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.