geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <>
Subject Re: [vote] XML Parsing
Date Wed, 03 Sep 2003 19:18:27 GMT
On Wednesday, September 3, 2003, at 11:27 AM, James Strachan wrote:

> On Wednesday, September 3, 2003, at 04:45  pm, Dain Sundstrom wrote:
>>>> What happens when you have exceptions and non trivial mappings.  
>>>> For example, I have a place where I named an xml attribute named 
>>>> "class", but the class attribute is named "name" because the spec 
>>>> calls it that (and the spec is wrong).
>>> Betwixt just makes a special kind of Digester. Its still a Digester 
>>> so you can still happily add any wierd/wacky rules you want. Also 
>>> for doing simple property / XML changes there's a little .betwixt 
>>> mapping XML file you can do this with. Though I doubt we'll need to 
>>> worry about that - we can just code the beans right (so they use the 
>>> same property names as the XML elements/attributes).
>> That is my exact problem... In this case the beans are required by 
>> the JMX specification and they got the naming wrong.
> Which beans are we talking about? I've been talking about the 7 XSD 
> schemas. Are you talking about something else? You're not off in MLET 
> land or something are you?

I am specifically mentioning something I am working on right now.  It 
is an xml file that describes the contents of a MBeanInfo class.  Most 
of the mapping is trivial except for one specific place where I don't 
want my xml attribute to have the same name as my Java Bean property, 
because the bean was designed wrong (and it is out of my control).

Back to your example, there is all sorts of terrible xml in the ejb-jar 
file.  For example, take a quick look at the relationship declaration 
in that file.  I don't think our java beans should have a equally 
terrible mapping because a spec committee got it wrong 2 years ago.

>> The JMX spec tries to reuse a base class for MBeanAttributeInfo, 
>> MBeanOperationInfo and MBeanNotificationInfo.  They all have a field 
>> called name, which makes since for attribute an operation, but for 
>> notification the spec says that name caries the java type of the 
>> notification object.  The over user of inheritance here has caused 
>> the property to have the wrong name.  In the xml I rename the 
>> property to name as it is easier for out users to understand.
>> My guess is there will be a ton of special mappings for the j2ee 
>> specs as the descriptors tend to be poorly designed.
> I don't follow. e.g. in ejb-jar or web.xml what are the issues? I 
> thought we were talking about beans to represent the 7 XSD schemas in 
> J2EE?

As I said above this is something I am writing from the other 
direction.  I have little control over the java beans and total control 
over the xml.

<notification class="" .....

java bean has

String getName();
void setName(String name)

This is a simple rename attribute mapping.  When we get into 
ejb-jar.xml, the mappings will be less trivial.

>> Is it building a reverse digester using Digester or does it have it's 
>> own logic that knows how to do it?  I like that feature, but not the 
>> rest of Betwixt.
> There is no digester feature to output XML. So the output of XML is a 
> purely betwixt thing. Basically Betwixt creates a little XMLBeanInfo 
> class which describes how to map it to XML and this is used to go XML 
> -> bean (defaulting digester rules) and to go bean -> XML.

Can we use that without using the auto rule generation in Betwixt?  I 
would really like to have a simple rule system like Digester which does 
xml generation from POJOs.


View raw message