Package javax.xml.xpath

Examples of javax.xml.xpath.XPathFactory


        if (ais != null) {
            for (AssertionInfo ai : ais) {
                RequiredElements rp = (RequiredElements)ai.getAssertion();
                ai.setAsserted(true);
                Map<String, String> namespaces = rp.getDeclaredNamespaces();
                XPathFactory factory = XPathFactory.newInstance();
                for (String expression : rp.getXPathExpressions()) {
                    XPath xpath = factory.newXPath();
                    if (namespaces != null) {
                        xpath.setNamespaceContext(new MapNamespaceContext(namespaces));
                    }
                    NodeList list;
                    try {
View Full Code Here


        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
        return docBuilderFactory.newDocumentBuilder();
    }

    private void parseDocument(Document doc) throws Exception {
        XPathFactory xPathFactory = XPathFactory.newInstance();
        XPath xPath = xPathFactory.newXPath();
        // Use a bunch of incremental XPath expressions rather than one big XPath expression,
        // so we can provide better log messages.
        Node invokerMBeanNode = (Node)xPath.evaluate("//server/mbean[@name = 'jboss.jmx:type=adaptor,name=Invoker']",
                    doc, XPathConstants.NODE);
        if (invokerMBeanNode == null) {
View Full Code Here

                XmlFixture.toDoc(aExpectedFile),
                noTime);
        // assert that we have a timestamp and datetime
        // can't rely on the datetime being the same due to timezone differences
        // instead, we'll assert that the values exist.
        XPathFactory xpf = XPathFactory.newInstance();
        XPath xp = xpf.newXPath();
        xp.setNamespaceContext(new NamespaceContext() {
            public String getNamespaceURI(String aArg0) {
                return "urn:org.apache.camel.component:jmx";
            }
            public String getPrefix(String aArg0) {
View Full Code Here

      booleanExpression = booleanExpression.replaceAll("\\$" + i, "'" + inputVal + "'");
    }

    // Now the XPath expression
    try {
      XPathFactory xpathFact = XPathFactory.newInstance();
      XPath xpath = xpathFact.newXPath();
      Boolean result = (Boolean) xpath.evaluate(booleanExpression, booleanExpression, XPathConstants.BOOLEAN);

      /*
       * Set control port to make execution flow continue according to
       * condition
 
View Full Code Here

      }
    };

    // Now the XPath expression
    String xpathStr = "/tg:Kit.Services/Service/Endpoint/text()";
    XPathFactory xpathFact = XPathFactory.newInstance();
    XPath xpath = xpathFact.newXPath();
    xpath.setNamespaceContext(ctx);

    try {
      Object endPoint;
View Full Code Here

  public void init() throws ServletException {

    try {
      builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();

      XPathFactory factory = XPathFactory.newInstance();
      XPath xpath = factory.newXPath();

      domainrelXpath = xpath.compile("//*[@class='domain-rel']");
      semrelXpath = xpath.compile("//*[@class='sem-rel']");
      semclassXpath = xpath.compile("//*[@class='sem-class']");

 
View Full Code Here

            List<Element> found) throws XPathExpressionException, SOAPException {
       
        List<WSEncryptionPart> result = new ArrayList<WSEncryptionPart>();
       
        if (xpaths != null && !xpaths.isEmpty()) {
            XPathFactory factory = XPathFactory.newInstance();
            for (String expression : xpaths) {
                XPath xpath = factory.newXPath();
                if (namespaces != null) {
                    xpath.setNamespaceContext(new MapNamespaceContext(namespaces));
                }
              
                NodeList list = (NodeList)xpath.evaluate(expression, saaj.getSOAPPart().getEnvelope(),
View Full Code Here

        if (ais != null) {
            for (AssertionInfo ai : ais) {
                RequiredElements rp = (RequiredElements)ai.getAssertion();
                ai.setAsserted(true);
                Map<String, String> namespaces = rp.getDeclaredNamespaces();
                XPathFactory factory = XPathFactory.newInstance();
                for (String expression : rp.getXPathExpressions()) {
                    XPath xpath = factory.newXPath();
                    if (namespaces != null) {
                        xpath.setNamespaceContext(new MapNamespaceContext(namespaces));
                    }
                    NodeList list;
                    try {
View Full Code Here

            List<Element> found) throws XPathExpressionException, SOAPException {
       
        List<WSEncryptionPart> result = new ArrayList<WSEncryptionPart>();
       
        if (xpaths != null && !xpaths.isEmpty()) {
            XPathFactory factory = XPathFactory.newInstance();
            for (String expression : xpaths) {
                XPath xpath = factory.newXPath();
                if (namespaces != null) {
                    xpath.setNamespaceContext(new MapNamespaceContext(namespaces));
                }
              
                NodeList list = (NodeList)xpath.evaluate(expression, saaj.getSOAPPart().getEnvelope(),
View Full Code Here

      URL url = new URL(surl + "&zipCodeList=" + zipcode);
      // the URL returns an XML doc
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.parse(url.openStream());
      XPathFactory xPathfactory = XPathFactory.newInstance();
      XPath xpath = xPathfactory.newXPath();

      XPathExpression exprmin =
          xpath.compile("/dwml/data/parameters/temperature[@type='minimum']/value[1]");
      String minimum = (String) exprmin.evaluate(doc, XPathConstants.STRING);
      // update datastore
View Full Code Here

TOP

Related Classes of javax.xml.xpath.XPathFactory

Copyright © 2018 www.massapicom. 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.