[jdom-interest] Re: Subclassing Element/Attribute

daves.subscriptions at SAFe-mail.net daves.subscriptions at SAFe-mail.net
Fri Jul 19 11:43:16 PDT 2002


Thanks for the quick replies.

For the benefit of any other beginning JDOM hacker, here's what you do:

Create a subclass of DefaultJDOMFactory.  Override the element() and attribute() methods to call the constructors for your Element and Attribute classes.  Then set the factory on the builder like so:
 
SAXBuilder builder = new SAXBuilder(validate);
builder.setFactory(new MyJDOMFactory());
Document doc = builder.build(in);
 
Might be a good thing to add to the FAQ?  Maybe a JDOM Cookbook.

Thanks,
-- Dave




More information about the jdom-interest mailing list