Package org.jaxen.dom

Examples of org.jaxen.dom.DOMXPath.evaluate()


       
        XPath xpath = new DOMXPath( "name(//c/preceding::*[1])" );
        DocumentBuilder builder = factory.newDocumentBuilder();
   
        doc = builder.parse("xml/web2.xml");
        Object result = xpath.evaluate(doc);
        assertEquals("d", result);
    }
   

    public void testJaxen207()
View Full Code Here


    }

    public void testEqualsTwoNodesets() throws JaxenException
    {
        XPath xpath = new DOMXPath( "//b = //c" );
        Boolean result = (Boolean) xpath.evaluate( doc );
        assertTrue( result.booleanValue() );
    }

    public void testNotEqualsTwoNodesets() throws JaxenException
    {
View Full Code Here

    }

    public void testNotEqualsTwoNodesets() throws JaxenException
    {
        XPath xpath = new DOMXPath( "//a != //b" );
        Boolean result = (Boolean) xpath.evaluate( doc );
        assertTrue( result.booleanValue() );
    }

    public void testEqualsStringNodeset() throws JaxenException
    {
View Full Code Here

    }

    public void testEqualsStringNodeset() throws JaxenException
    {
        XPath xpath = new DOMXPath( "//b = 'blort'" );
        Boolean result = (Boolean) xpath.evaluate( doc );
        assertTrue(result.booleanValue());
    }

    public void testNotEqualsStringNodeset() throws JaxenException
    {
View Full Code Here

    }

    public void testNotEqualsStringNodeset() throws JaxenException
    {
        XPath xpath = new DOMXPath( "//b != 'phooey'" );
        Boolean result = (Boolean) xpath.evaluate( doc );
        assertTrue(result.booleanValue());
    }

    public void testEqualsNumberNodeset() throws JaxenException
    {
View Full Code Here

    }

    public void testEqualsNumberNodeset() throws JaxenException
    {
        XPath xpath = new DOMXPath( "//c = 12" );
        Boolean result = (Boolean) xpath.evaluate( doc );
        assertTrue(result.booleanValue());
    }

    public void testNotEqualsNumberNodeset() throws JaxenException
    {
View Full Code Here

    }   
   
    public void testNamespaceURIOfEmptyNodeSetIsEmptyString() throws JaxenException
    {
        XPath xpath = new DOMXPath( "namespace-uri(/aaa)" );
        String result = (String) xpath.evaluate(doc);
        assertEquals("", result);
    }   

    public void testNamespaceURIOfProcessingInstructionIsEmptyString() throws JaxenException
    {
View Full Code Here

    public void testNamespaceURIOfProcessingInstructionIsEmptyString() throws JaxenException
    {
        XPath xpath = new DOMXPath( "namespace-uri(/processing-instruction())" );
        ProcessingInstruction pi = doc.createProcessingInstruction("target", "value");
        doc.appendChild(pi);
        String result = (String) xpath.evaluate(doc);
        assertEquals("", result);
    }   

    public void testNamespaceURIOfAttribute() throws JaxenException
    {
View Full Code Here

    public void testNamespaceURIOfAttribute() throws JaxenException
    {
        XPath xpath = new DOMXPath( "namespace-uri(/*/@*)" );
        Attr a = doc.createAttribute("name");
        doc.getDocumentElement().setAttributeNode(a);
        Object result = xpath.evaluate(doc);
        assertEquals("", result);
    }   

    public void testNamespaceURIOfAttributeInNamespace() throws JaxenException
    {
View Full Code Here

    public void testNamespaceURIOfAttributeInNamespace() throws JaxenException
    {
        XPath xpath = new DOMXPath( "namespace-uri(/*/@*)" );
        Attr a = doc.createAttributeNS("http://www.w3.org/", "pre:name");
        doc.getDocumentElement().setAttributeNode(a);
        Object result = xpath.evaluate(doc);
        assertEquals("http://www.w3.org/", result);
    }   

    public void testNamespaceURIOfTextIsEmptyString() throws JaxenException
    {
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.