final DocumentImpl doc = (DocumentImpl)node.getOwnerDocument();
doc.getMetadata().setIndexListener(listener);
if (!doc.getPermissions().validate(broker.getSubject(), Permission.WRITE)) {
throw new PermissionDeniedException("User '" + broker.getSubject().getName() + "' does not have permission to write to the document '" + doc.getDocumentURI() + "'!");
}
node.appendChildren(transaction, children, child);
doc.getMetadata().clearIndexListener();
doc.getMetadata().setLastModified(System.currentTimeMillis());
modifiedDocuments.add(doc);
broker.storeXMLResource(transaction, doc);
notifier.notifyUpdate(doc, UpdateListener.UPDATE);