@Override
	public Element clone() {

		// Ken Rune Helland <kenh@csc.no> is our local clone() guru

		final Element element = (Element) super.clone();

		// name and namespace are references to immutable objects
		// so super.clone() handles them ok

		// Reference to parent is copied by super.clone()
		// (Object.clone()) so we have to remove it
		// Actually, super is a Content, which has already detached in the
		// clone().
		// element.parent = null;

		// Reference to content list and attribute lists are copyed by
		// super.clone() so we set it new lists if the original had lists
		element.content = new ContentList(element);
		element.attributes = attributes == null ? null : new AttributeList(element);

		// Cloning attributes
		if (attributes != null) {
			for(int i = 0; i < attributes.size(); i++) {
				final Attribute attribute = attributes.get(i);
				element.attributes.add(attribute.clone());
			}
		}

		// Cloning additional namespaces
		if (additionalNamespaces != null) {
			element.additionalNamespaces = new ArrayList<Namespace>(additionalNamespaces);
		}

		// Cloning content
		for(int i = 0; i < content.size(); i++) {
			final Content c = content.get(i);
			element.content.add(c.clone());
		}

		return element;
	}