[jdom-interest] Attribute defaults

Jason Hunter jhunter at acm.org
Tue Nov 20 08:41:56 PST 2001


I would very much like Attributes to have that ability.  I think it's a
feature we could have using an XNI-based builder.  It's only because SAX
doesn't provide it that you can't get this information from SAXBuilder. 
Interestingly, it would be available using DOMBuilder.

So, it is best to have a getSpecified() method on Attribute (like DOM
has on Attr) or is this something to solve with the attribute type
proposal made by elharo?

-jh-

Tom Dimock wrote:
> 
> 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
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list