[jdom-interest] Test - Expanding <script> element.

Jason Hunter jhunter at xquery.com
Mon Mar 21 15:35:26 PST 2005

Bradley S. Huffman wrote:

> Jason Hunter writes:
>>Per Norrman wrote:
>>>Probably, the temporary preserveFormat should reflect the
>>>expandEmptyElement property of the userFormat.
>>I think you pegged it, Per.  We'll have to change the mechanism for 
>>obtaining the preserveFormat instance in XMLOutputter to bring over the 
>>pertinent attributes of the userFormat:
>>* expandEmptyElement
>>* ignoreTrAXEscapingPIs
>>* escapeStrategy
> What about the other attributes that are non-formatting related but
> subclassers want access too, since they have access to currentFormat?
> How about these static methods in Format
>     getRawFormat(Format old)
>     getPrettyFormat(Format old)
>     getCompactFormat(Format old)
> that copy all other non-format related attributes of the old format and set
> the format related attributes appropriately.
> If that didn't make sense the diff's for Format and XMLOutputter are below.
> Brad

If we were to place this functionality in a method, wouldn't it make 
sense to use just a single method?  It just doesn't seem right to have 
each of the static factory methods also include an optional template 
parameter.  I'm not sure what the one method would be named.  Something 
like format.setSubsetFrom(old) but that's a terrible name.  The idea 
though would be to set the pertinent fields from one onto another.  But 
before worrying about it's name, maybe you could explain more why 
subclassers would be better served by a method?

My vision was to change preserveFormat from a static to an instance 
variable and to let its behavior related to the above 3 properties vary 
according to the currentFormat rules.  No API change, just a bug fix.


More information about the jdom-interest mailing list