Element parent = new Element("Test", "http://www.example.org");
Element child = new Element("child", "http://www.example.org");
parent.appendChild(child);
XPathContext context = new XPathContext("pre", "http://www.example.com");
Nodes result = parent.query("child::pre:child", context);
assertEquals(0, result.size());
context.addNamespace("pre", "http://www.example.org");
result = parent.query("child::pre:child", context);
assertEquals(1, result.size());
assertEquals(child, result.get(0));
}