// TODO point this, at least optionally, at the jaxen directory in the zip file instead.
// However, first you'll have to push a jaxen 1.2.1 that fixes tests.xml.
String base = "http://svn.jaxen.codehaus.org/browse/~raw,r=trunk/jaxen/trunk/jaxen/";
Builder builder = new Builder();
Document testDoc = builder.build(base + "xml/test/tests.xml");
Elements documents = testDoc.getRootElement().getChildElements("document");
for (int i = 0; i < documents.size(); i++) {
Element documentElement = documents.get(i);
String url = documentElement.getAttributeValue("url");
Document source = builder.build(
"http://svn.jaxen.codehaus.org/browse/~raw,r=trunk/jaxen/trunk/jaxen/"
+ url);
Elements contextElements = documentElement.getChildElements("context");
for (int j = 0; j < contextElements.size(); j++) {
Element contextElement = contextElements.get(j);
// skip tests that use variables
// because XOM doesn't support variables in
// XPath expressions
if (queryUsesVars(contextElement)) continue;
String xpath = contextElement.getAttributeValue("select");
XPathContext namespaces = getXPathContext(contextElement);
Node context = source.query(xpath).get(0);
// process counts
Elements tests = contextElement.getChildElements("test");
for (int k = 0; k < tests.size(); k++) {
Element test = tests.get(k);