query.append("xquery version \"1.0\";");
query.append("let $survey := xmldb:document(concat('" + XmldbURI.ROOT_COLLECTION + "', '/', $document))");
query.append("return ($survey)");
service.declareVariable("document", document);
CompiledExpression cQuery = service.compile(query.toString());
ResourceSet set = service.execute(cQuery);
if (set != null && set.getSize() > 0) {
return ((XMLResource)set.getIterator().nextResource()).getContentAsDOM();
}
return null;