saveDocument(usersXML); }
} } else { expression = " try { elem = (Element)xpath.evaluate(expression, this.doc, XPathConstants.NODE); } catch (XPathExpressionException e) { ErrorManager.getInstance().setErrTitle("Expression XPath Incorrecte"); ErrorManager.getInstance().setErrMsg("Expression XPath "+ expression +" Incorrecte"); throw new XPathExpressionException(expression); } if (elem != null) { String parentExpr = " Element parentElem = null; try { parentElem = (Element)xpath.evaluate(parentExpr, this.doc, XPathConstants.NODE); } catch (XPathExpressionException e) { ErrorManager.getInstance().setErrTitle("Expression XPath Incorrecte"); ErrorManager.getInstance().setErrMsg("Expression XPath "+ expression +" Incorrecte"); throw new XPathExpressionException(expression); } parentElem.removeChild(elem); saveDocument(usersXML); } } }
	public void setAttribute(String login, String attr, String newValue) throws Exception, NullPointerException	{		XPath xpath = XPathFactory.newInstance().newXPath();		String expression = "//user[@login='"+login+"']";		Element elem = null;				try {			elem = (Element)xpath.evaluate(expression, this.doc, XPathConstants.NODE);		}		catch (XPathExpressionException e) {			ErrorManager.getInstance().setErrTitle("Expression XPath Incorrecte");			ErrorManager.getInstance().setErrMsg("Expression XPath "+ expression +" Incorrecte");			throw new XPathExpressionException(expression);		}		if ( elem != null ) {			if (attr == ATTR_LOGIN || attr == ATTR_PASSWD){				elem.setAttribute(attr, newValue);									saveDocument(usersXML);			}		}		else {			ErrorManager.getInstance().setErrTitle("Utilisateur inconnu");			ErrorManager.getInstance().setErrMsg("L'utilisateur "+ login +" est inconnu.\n");			throw new NullPointerException(); 		}	}