Package org.jdom.xpath

Examples of org.jdom.xpath.XPath.selectSingleNode()


            Document doc = new SAXBuilder().build( req.getInputStream() );
                   
            XPath xpath = XPath.newInstance("/D:propfind/*");
            xpath.addNamespace( "D", "DAV:" );
       
            Element firstnode = (Element)xpath.selectSingleNode( doc );

            Element davresponse = null;

            System.out.println("Request="+dc.getPath()+" depth="+dc.getDepth());

View Full Code Here


        Document doc = builder.build( new File( basedir, ".classpath" ) );

        XPath resourcePath = XPath.newInstance( "//classpathentry[@path='src/main/resources']" );

        assertTrue( "resources classpath entry not found.", resourcePath.selectSingleNode( doc ) != null );

        XPath testResourcePath = XPath.newInstance( "//classpathentry[@path='src/test/resources']" );

        assertTrue( "test resources (minus custom output dir) classpath entry not found.",
                    testResourcePath.selectSingleNode( doc ) != null );
View Full Code Here

        assertTrue( "resources classpath entry not found.", resourcePath.selectSingleNode( doc ) != null );

        XPath testResourcePath = XPath.newInstance( "//classpathentry[@path='src/test/resources']" );

        assertTrue( "test resources (minus custom output dir) classpath entry not found.",
                    testResourcePath.selectSingleNode( doc ) != null );

        XPath stdOutputPath = XPath.newInstance( "//classpathentry[@kind='output' && @path='target/classes']" );

        assertTrue( "standard output classpath entry not found.", stdOutputPath.selectSingleNode( doc ) != null );
View Full Code Here

        assertTrue( "test resources (minus custom output dir) classpath entry not found.",
                    testResourcePath.selectSingleNode( doc ) != null );

        XPath stdOutputPath = XPath.newInstance( "//classpathentry[@kind='output' && @path='target/classes']" );

        assertTrue( "standard output classpath entry not found.", stdOutputPath.selectSingleNode( doc ) != null );

    }

    public void testWrite_ShouldGenerateValidJavadocURLs()
        throws MojoExecutionException, JDOMException, IOException
View Full Code Here

        OMElement response = stub.getStockQuote(child);

        StAXBuilder builder = new StAXBuilder();
        Document doc = builder.build(response.getXMLStreamReader());
        XPath path = XPath.newInstance("//price");
        Element price = (Element) path.selectSingleNode(doc.getRootElement());
        System.out.println("Price = " + price.getText());
    }

    private static class JDOMDataSource implements OMDataSource {
        private final Element data;
View Full Code Here

        OMElement response = stub.getStockQuote(child);

        StAXBuilder builder = new StAXBuilder();
        Document doc = builder.build(response.getXMLStreamReader());
        XPath path = XPath.newInstance("//price");
        Element price = (Element) path.selectSingleNode(doc.getRootElement());
        System.out.println("Price = " + price.getText());
    }

    private static class JDOMDataSource implements OMDataSource {
        private final Element data;
View Full Code Here

    }

    private Element getMatch(Object doc, String xpath) {
        try {
            XPath path = XPath.newInstance(xpath);
            return (Element)path.selectSingleNode(doc);
        } catch (JDOMException e) {
            throw new DatabindingException("Error evaluating xpath " + xpath, e);
        }
    }
View Full Code Here

            Document doc = new SAXBuilder().build( req.getInputStream() );
                   
            XPath xpath = XPath.newInstance("/D:propfind/*");
            xpath.addNamespace( "D", "DAV:" );
       
            Element firstnode = (Element)xpath.selectSingleNode( doc );

            Element davresponse = null;

            System.out.println("Request="+dc.getPath()+" depth="+dc.getDepth());

View Full Code Here

    }

    private Element getMatch(Object doc, String xpath) {
        try {
            XPath path = XPath.newInstance(xpath);
            return (Element)path.selectSingleNode(doc);
        } catch (JDOMException e) {
            throw new DatabindingException("Error evaluating xpath " + xpath, e);
        }
    }
View Full Code Here

        XPath xpathEmail = XPath.newInstance("//contacts/contact/email");


        Element nomElement = (Element) xpathNom.selectSingleNode(document);
        Element prenomElement = (Element) xpathPrenom.selectSingleNode(document);
        Element emailElement = (Element) xpathEmail.selectSingleNode(document);

        assertEquals("nom", nomElement.getText());
        assertEquals("prenom", prenomElement.getText());
        assertEquals("hikage@hikage.be", emailElement.getText());
        assertEquals("personnelle", emailElement.getAttributeValue("type"));
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.