public Object 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 = new AttributeList(element);

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

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

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

        return element;
    }