users@jaxb.java.net

JAXB annotation - depending on the content of an xml-attribute

From: hari_ <havo_at_edumail.at>
Date: Sun, 29 Apr 2007 23:27:26 -0700 (PDT)

Hello!

Can someone help me please with the following problem:

My xml looks like the following example:
...
<model>
<property name=”boolProp” type=”Boolean” value=”true”/>
<property name=”intProp” type=”Integer” value=”4” minValue=”1”
maxValue=”3”/>
</model>
...

The model classes:

abstract class Property {
String name;
String type;
String value;
//...
}

class BooleanProperty extends Property {
// no additional members
//...
}

class IntegerProperty extends Property {
String minValue;
String maxValue;
//...
}

class Model {
// @XmlElement or ?????
List<Property> properties;
//...
}

I don’t know how to annotate the List<Property> that JAXB creates the
different model classes (Boolean or IntegerProperty) depending on the type
attribute in the property-tag.

Has anyone an idea how to do this?

Thank you for your help!
-- 
View this message in context: http://www.nabble.com/JAXB-annotation---depending-on-the-content-of-an-xml-attribute-tf3668108.html#a10249062
Sent from the java.net - jaxb users mailing list archive at Nabble.com.