My suggestion would be to write some schema for what you would like it to look like and generate some code and check the annotations. I'm really not sure what the annotations should look like in this case.
I THINK your SearchCondition class would need some annotations on it. Probably both XmlType and XmlRootElement annotations. Not really sure though. EqualSearchCondition probably should have an XmlType as well. It could also be that as soon as you put the "name" attribute on the XmlElementRef, you then would need an ObjectFactory with a method with the appropriate @XmlElementDecl(name ="conditions") annotation. Dan On Wednesday 24 September 2008 5:25:22 am Rajeev jha wrote: > Hi > I am trying to work some code on the lines on the following example > (https://jaxb.dev.java.net/nonav/2.1.6/docs/api/javax/xml/bind/annotation/X >mlElementRef.html) > > From what I see in the above example it should be possible to work with > abstract class as "TYPE" using JAXB and CXF. I am trying the following > example: > > 1) SearchFilter class having SearchCondition > > @XmlRootElement(name="SearchFilter") > @XmlAccessorType(value = XmlAccessType.FIELD) > > public class SearchFilter { > @XmlElementRef(name="conditions") > List<SearchCondition> conditions = new ArrayList<SearchCondition>(); > > 2) SearchCondition is an abstract class > public abstract class SearchCondition { > > public SearchCondition () {} > public abstract String stringify(Map<String, String> map) ; > > 3) EqualSearchCondition is an example of SearchCondition > @XmlRootElement(name="EqualSearchCondition") > public class EqualSearchCondition extends SearchCondition{ > > I am running on tomcat 5.5.17, CXF2.1.1 , jaxb-impl2.1.6. On startup Tomcat > shows the following error > > Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 > counts of > IllegalAnnotationExceptions > XmlElementRef points to a non-existent class. > > what am I missing? is this any known issue with CXF 2.1.1 ? > > Thanks > > -Rajeev. -- Daniel Kulp [EMAIL PROTECTED] http://www.dankulp.com/blog
