private final void flushActiveElement() {
		if (activeelement != null) {
			
			/*
			 * Add any written namespaces to the element as declared namespaces
			 * unless they are implied namespaces used by attributes, or something.
			 * If this Element is expecting content (it's not empty) then we also
			 * push the modified Element on to the Namespace stack.
			 */

			boolean mod = false;
			usednsstack.push(activeelement);
			for (Namespace ns : pendingns) {
				if (!usednsstack.isInScope(ns)) {
					activeelement.addNamespaceDeclaration(ns);
					mod = true;
				}
			}
			pendingns.clear();
			
			if (mod) {
				usednsstack.pop();
				if (isempty) {
					boundstack.pop();
					activeelement = null;
					return;
				}
				// reload the stack with the additional namespaces.
				usednsstack.push(activeelement);
			}
			if (isempty) {
				boundstack.pop();
				activeelement = null;
				return;
			}
			boundstack.push(activeelement);
			boundstack.push();
			
			activeelement = null;
		}
	}