String xpathExp = reader.getAttributeValue(null, "attachTo");
XPath xpath = xpathHelper.newXPath();
// Compile the expression without taking a snapshot of the namespace context
XPathExpression expression = xpathHelper.compile(xpath, reader.getNamespaceContext(), xpathExp);
// Advance the reader so that the namespace context changes its prefix/namespace mapping
reader.nextTag();
reader.close();
Document doc = domHelper.load(XML);
NodeList nodes = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);
Assert.assertEquals(1, nodes.getLength());