if (parent == null || parent.getNodeType() != Node.ELEMENT_NODE) {
throw new EXistException(
"you cannot remove the document element. Use update "
+ "instead");
} else
{parent.removeChild(transaction, node);}
doc.getMetadata().clearIndexListener();
doc.getMetadata().setLastModified(System.currentTimeMillis());
modifiedDocuments.add(doc);
broker.storeXMLResource(transaction, doc);
notifier.notifyUpdate(doc, UpdateListener.UPDATE);