Element child = new Element("b:child", "http://www.example.org");
Attribute att = new Attribute("c:dog", "http://www.cafeconleche.org/", "test");
parent.appendChild(child);
child.addAttribute(att);
XPathContext context = new XPathContext("pre", "http://www.example.org");
context.addNamespace("c", "http://www.cafeconleche.org/");
Nodes result = parent.query("child::pre:child", context);
assertEquals(1, result.size());
assertEquals(child, result.get(0));
result = child.query("@c:*", context);