Hi,

Seems to me that matches seems to match anything

Am I missing something?

Matched worked OK in 0.8, fails in 1.0 and 1.1

Any Ideas?

 

Test code

 

import org.dom4j.*;

import org.dom4j.xpath.*;

public class Bug {

 

    public static void main (String args[]) {

        Document top = DocumentFactory.getInstance().createDocument();

        Element root = top.addElement("root");

        root.addElement("child1").addElement("child11");

        root.addElement("child2").addElement("child21");

        System.out.println(top.asXML());

        XPath test1 = new DefaultXPath("/root/child1/child11");

        XPath test2 = new DefaultXPath("/root/child2/child21");

        Node position1 = test1.selectSingleNode(root);

        Node position2 = test2.selectSingleNode(root);

       

        System.out.println("test1= "+test1);

        System.out.println("test2= "+test2);

        System.out.println("Position1 Xpath = "+position1.getUniquePath());

        System.out.println("Position2 Xpath = "+position2.getUniquePath());

       

        System.out.println("test2.matches(position1) : "+test2.matches(position1));

       

    }

 

}

 

 

Mike Skells

eBizz Consulting

0774 052 0717

 

Reply via email to