xPath.setNamespaceContext(namespaceContext);
NodeList nodes = (NodeList)xPath.evaluate(xpath, doc, XPathConstants.NODESET);
Canonicalizer c14n =
Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
byte c14nBytes[] = c14n.canonicalizeXPathNodeSet(nodes);
InputStream refStream = resolver.resolveEntity(null,
fileRef).getByteStream();
byte refBytes[] = JavaUtils.getBytesFromStream(refStream);
assertEquals(new String(refBytes),new String(c14nBytes));
}