Package javax.xml.xpath

Examples of javax.xml.xpath.XPathFactory.newXPath()


        return new GFacConfiguration(airavataAPI);
    }

    private static String xpathGetText(Document doc, String expression) throws XPathExpressionException {
        XPathFactory xPathFactory = XPathFactory.newInstance();
        XPath xPath = xPathFactory.newXPath();
        XPathExpression expr = xPath.compile(expression);

        return (String) expr.evaluate(doc, XPathConstants.STRING);
    }
View Full Code Here


     * @return list of attribute values.
     * @throws XPathExpressionException
     */
    private static List<String> xpathGetAttributeValueList(Document doc, String expression, String attribute) throws XPathExpressionException {
        XPathFactory xPathFactory = XPathFactory.newInstance();
        XPath xPath = xPathFactory.newXPath();
        XPathExpression expr = xPath.compile(expression);

        NodeList nl = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);

        List<String> attributeValues = new ArrayList<String>();
View Full Code Here

    }

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

    @SuppressWarnings("unchecked")
    public static XPathExpression getXPathExpression(XPathFilterParameterSpec xpathFilter) throws XPathExpressionException {

        XPathFactory factory = XPathFactory.newInstance();
        XPath xpath = factory.newXPath();
        if (xpathFilter.getNamespaceMap() != null) {
            xpath.setNamespaceContext(new XPathNamespaceContext(xpathFilter.getNamespaceMap()));
        }
        return xpath.compile(xpathFilter.getXPath());
    }
View Full Code Here

        throws XPathExpressionException, SAXException, IOException, ParserConfigurationException {
        Message mess = getMessage(mock);
        InputStream body = mess.getBody(InputStream.class);
        assertNotNull(body);
        XPathFactory xpathFactory = XPathFactory.newInstance();
        XPath xpath = xpathFactory.newXPath();
        NamespaceContext nc = new NamespaceContext() {

            @SuppressWarnings("rawtypes")
            @Override
            public Iterator getPrefixes(String namespaceURI) {
View Full Code Here

    }

    @Override
    protected int run(CommandLine cmd) throws Exception {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        fieldXPath = xPathfactory.newXPath().compile("//field");
        descriptionXPath = xPathfactory.newXPath().compile("description/text()");

        File inFile = new File(cmd.getOptionValue(CMD_OPT_INPUT));
        if (!inFile.exists()) {
            System.err.println("Input file " + inFile.getAbsolutePath() + " does not exist.");
View Full Code Here

    @Override
    protected int run(CommandLine cmd) throws Exception {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        fieldXPath = xPathfactory.newXPath().compile("//field");
        descriptionXPath = xPathfactory.newXPath().compile("description/text()");

        File inFile = new File(cmd.getOptionValue(CMD_OPT_INPUT));
        if (!inFile.exists()) {
            System.err.println("Input file " + inFile.getAbsolutePath() + " does not exist.");
            return 1;
View Full Code Here

    }

    @Override
    protected int run(CommandLine cmd) throws Exception {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        countryXPath = xPathfactory.newXPath().compile("//country");
        fieldsXPath = xPathfactory.newXPath().compile("field");

        File inFile = new File(cmd.getOptionValue(CMD_OPT_INPUT));
        if (!inFile.exists()) {
            System.err.println("Input file " + inFile.getAbsolutePath() + " does not exist.");
View Full Code Here

    @Override
    protected int run(CommandLine cmd) throws Exception {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        countryXPath = xPathfactory.newXPath().compile("//country");
        fieldsXPath = xPathfactory.newXPath().compile("field");

        File inFile = new File(cmd.getOptionValue(CMD_OPT_INPUT));
        if (!inFile.exists()) {
            System.err.println("Input file " + inFile.getAbsolutePath() + " does not exist.");
            return 1;
View Full Code Here

    }

    public String getStartTime() throws OpsException {
      try {
        XPathFactory xPathfactory = XPathFactory.newInstance();
        XPath xpath = xPathfactory.newXPath();
        XPathExpression expr = xpath
            .compile("/response/lst[@name='status']/lst/date[@name='startTime']/text()");
        return (String) expr.evaluate(dom, XPathConstants.STRING);
      } catch (XPathExpressionException e) {
        throw new OpsException("Error reading value from XML", e);
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.