ElementImpl parent;
NodeImpl parent; IndexListener listener = new IndexListener(qr);
	public long process() throws PermissionDeniedException, EXistException {		List qr = select(docs);		NodeList children = content.getChildNodes();		if (qr == null || children.getLength() == 0)			return 0;		DocumentImpl doc;		Collection collection;		NodeImpl node;		ElementImpl parent;		String newName = children.item(0).getNodeValue();		int modificationCount = 0;		for (Iterator i = qr.iterator(); i.hasNext();) {			node = (NodeImpl) i.next();			doc = (DocumentImpl) node.getOwnerDocument();			collection = doc.getCollection();			if (!collection.getPermissions().validate(user, Permission.UPDATE))				throw new PermissionDeniedException(					"write access to collection denied; user=" + user.getName());			if (!doc.getPermissions().validate(user, Permission.UPDATE))				throw new PermissionDeniedException("permission denied to update document");			parent = (ElementImpl)node.getParentNode();			switch(node.getNodeType()) {				case Node.ELEMENT_NODE :					((ElementImpl)node).setNodeName(newName);					parent.updateChild(node, node);					modificationCount++;					break;				case Node.ATTRIBUTE_NODE :					((AttrImpl)node).setNodeName(newName);					parent.updateChild(node, node);					modificationCount++;					break;			}		}		return modificationCount;	}