[jdom-interest] Attribute defaults

rpcee rpcee at operamail.com
Wed Nov 21 09:28:42 PST 2001


xni would give you this - I've only seen the dtd callbacks as a result of a 
DOCTYPE in an xml instance, but perhaps you could point to the DTD directly 
using a XMLDTDHandler/XMLDTDContentModelHandler implementation; there are also 
other DTD parsers available.
The default values could be optionally and transparently stored in a flyweight 
rather than in each attribute if the space saving was worthwhile, for any 
reader which supported isSpecified, which would also work for hand built 
documents. I vaguely remember some part of xml-schema where the same element 
name could mean different things in different parts of the document which if 
true could be a complication.

Did you mean that setAttribute() would compare the attribute value against the 
default as well?
On output you could have a flag which said "write/dont write default values".
I'm not sure how much belongs in JDOM.


>===== Original Message From Tom Dimock <tad1 at cornell.edu> =====
>At 01:48 PM 11/20/2001 -0400, Elliotte Rusty Harold wrote:
>>At 8:41 AM -0800 11/20/01, Jason Hunter wrote:
>>>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.
>>>
>>
>>SAX 2.1 is scheduled to provide this. API is still uncertain but see
>>http://www.saxproject.org/apidoc/org/xml/sax/ext/Attributes2.html
>
>Ok, so using that I could look at each attribute as it was read and test
>isSpecified. Whenever it returned false, I have "discovered" a default
>value and could save it.  I guess I was hoping for a more direct way to
>discover the defaults - this relies on reading an existing XML file in
>which each attribute is defaulted at least once.  It would be useless if I
>had built the tree programatically and then went to output it.  What is
>really needed is to have the schema available through some API.
>
>----------------------------------------------------------------------------
>       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