*/
public static Document queryResultsToDOM(NodeSet nodeSet, boolean expandSource) {
DocumentImpl doc = new DocumentImpl();
Element root = doc.createElement("result");
doc.appendChild(root);
int count = 0;
while (nodeSet != null && nodeSet.hasMoreNodes()) {
final Object element = nodeSet.getNextNode();
if (element instanceof Attr) {
Attr n = (Attr) element;