[jdom-interest] Extending Element

Charles Havranek havranekca at xde.net
Sat Aug 2 09:38:42 PDT 2003


Been searching the archives and can't find a good answer or example for 
extending an element to add my own helper methods.  Trying :
    public xdeElement() {
    }
    public static void main(String[] arg){
        org.jdom.Element name = new org.jdom.Element("name");
        name.setAttribute("language", "English");
        xdeElement tmp= new xdeElement(name);
    }
    /** Create a new Element based on existing Element */
    public xdeElement(Element existingElement){
        super.setContent(existingElement.getContent());
        System.out.println("Original: "+ 
existingElement.getAttributeValue("language"));
        System.out.println("This: "+ this.getAttributeValue("language"));
        System.out.println("Super: "+ super.getAttributeValue("language"));
    }

when run, it Outputs :
Original: English
This: null
Super: null

Sure I'm doing something wrong ... but what?

Thanks much!
Charles Havranek









More information about the jdom-interest mailing list