public void leaveElement (String name) throws Exception {

		// check for active custom parser
		if (customParser != null) {
			// delegate parsing to handler.
			customParser.leaveElement (name);
			// check if handler is done-
			if (!customParser.isDone())
				return;
			
			// handle specific result.
			if (customParser instanceof AP_Generic) {
				AP_Generic handler = (AP_Generic) customParser;
				
				// we have a new identity for the given auth protocol:
				AuthProtocolHandler.Identity id = handler.getIdentity();
				
				// if no identity is associated with is protocol
				// it is anonymous (but counts as authenticated)
				if (id != null) {
					// register identity
					String idName = proto;
					if (domain != null)
						idName += "@" + domain;
					inst.addIdentity (idName, id);
					// assemble message
					StringBuffer buf = new StringBuffer();
					buf.append ("   Identity '");
					buf.append (id.getName());
					buf.append ("' registered for ");
					if (domain == null) {
						buf.append ("negotiation.");
					} else {
						buf.append ("'");
						buf.append (idName);
						buf.append ("'.");
					}
					System.out.println (buf.toString());
				}
			}
			// disable custom parsing
			customParser = null;
		}
		//-------------------------------------------------------------
		// </Keyring>
		//-------------------------------------------------------------
		if (name.equals ("Keyring")) {
			done = true;
			return;
		}
		//-------------------------------------------------------------
		// </Protocols>
		//-------------------------------------------------------------
		if (name.equals ("Protocols")) {
			return;
		}
		//-------------------------------------------------------------
		// </Protocol>
		//-------------------------------------------------------------
		if (name.equals ("Protocol")) {
			return;
		}
	}