[jdom-interest] Attribute defaults

Tom Dimock tad1 at cornell.edu
Tue Nov 20 06:57:21 PST 2001


In the project I'm working on, many of the elements have attributes which
are normally set to the default value from the DTD.  When I load this XML
in with JDOM and then write it out again, the size of the XML file doubles,
because JDOM writes out all of these attributes which were defaulted in the
original file.  Now, I know that JDOM does not have the necessary knowledge
of the DTD or XML schema to be able to deal with this, but I'd really like
to be able to save my JDOM tree in the more compact form.  Would there be
any interest in allowing Attribute objects to optionally have a default
field, which could be used to suppress output of the attribute?

I know this was a major feature of the early work by Sun in trying to
XML-serialize Swing objects, which have huge numbers of attributes, most of
which were usually default values.
----------------------------------------------------------------------------
       Tom Dimock  ----  Cornell University  ----  tad1 at cornell.edu
"There go my people.  I must follow them, for I am their leader."  M. Gandhi



More information about the jdom-interest mailing list