throw new SAXException(e);
throw new SAXException(e.getMessage(), e);
	public void startElement(String namespaceURI, String localName, String qName, Attributes atts)		throws SAXException {		if (namespaceURI.equals(NS)) {			if (localName.equals("collection")) {				final String name = atts.getValue("name");				final String owner = atts.getValue("owner");				final String group = atts.getValue("group");				final String mode = atts.getValue("mode");				if (name == null)					throw new SAXException("collection requires a name " + "attribute");				try {					if(dialog != null)						dialog.displayMessage("creating collection " + name);					current = mkcol(name);					UserManagementService service =						(UserManagementService) current.getService("UserManagementService", "1.0");					User u = new User(owner, null, group);					service.chown(u, group);					service.chmod(Integer.parseInt(mode, 8));				} catch (XMLDBException e) {					throw new SAXException(e);				}				if(dialog != null)					dialog.setCollection(name);			} else if (localName.equals("subcollection")) {				final String name = atts.getValue("name");				final String fname =					contents.getParentFile().getAbsolutePath()						+ File.separatorChar						+ name						+ File.separatorChar						+ "__contents__.xml";				final File f = new File(fname);				if (f.exists() && f.canRead())					stack.push(f);				else					System.err.println(f.getAbsolutePath() + " does not exist or is not readable.");			} else if (localName.equals("resource")) {				final String name = atts.getValue("name");				final String owner = atts.getValue("owner");				final String group = atts.getValue("group");				final String perms = atts.getValue("mode");				if (name == null)					throw new SAXException("collection requires a name " + "attribute");				final File f =					new File(						contents.getParentFile().getAbsolutePath() + File.separatorChar + name);				try {					if (dialog != null && current instanceof Observable) {						((Observable) current).addObserver(dialog.getObserver());					}					dialog.setResource(name);					final XMLResource res =						(XMLResource) current.createResource(name, "XMLResource");					res.setContent(f);					if(dialog == null)						System.out.println("restoring " + name);					current.storeResource(res);					UserManagementService service =						(UserManagementService) current.getService("UserManagementService", "1.0");					User u = new User(owner, null, group);					service.chown(res, u, group);					service.chmod(res, Integer.parseInt(perms, 8));					if(dialog != null)						dialog.displayMessage("restored " + name);				} catch (XMLDBException e) {					throw new SAXException(e);				}			}		}	}