[jboss-dev-forums] [Design of POJO Server] - Re: JAXBDeployer

adrian@jboss.org do-not-reply at jboss.com
Fri Jan 26 08:10:00 EST 2007


anonymous wrote : 
  | This is possible in JAXB, if you have the following in your root type:
  | Code:
  | 
  |   // Array of Element or JAXB elements.
  |  @XmlAnyElement(lax="true")
  |  public Object[] others;
  | 
  | JAXB dynamically resolves type information off of annotations. So before unmarshalling, if you pass the JAXBContext a FooType.class.
  | 

That isn't what the example does.

JBossXB uses the xml namespace to determine the class to unmarshal
as the wildcard. You don't have to tell it a fixed number of classes/packages upfront
on the JAXBContext.

JAXB is simply not extensible to abitrary wildcards.



  |       <xsd:choice>
  |          <xsd:element name="string" type="stringType" minOccurs="0"/>
  |          <xsd:element name="blah" type="blahType" minOccurs="0"/>
  |          <xsd:any namespace="##other" processContents="strict" minOccurs="0"/>
  |       </xsd:choice>
  | 
  | @RootElement
  | public class MyClass
  | {
  |    <!-- Known bindings -->
  |    @XmlElement(name="string" type=StringSomething.class)
  |    @XmlElement(name="blah" type=BlahSomething.class)
  | 
  |    <!-- Wildcard -->
  |    @XmlAnyElement(I'll accept anything that implements the interface!)
  |    public void setSomethings(List<Something> somethings) {}
  | }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4006792#4006792

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4006792



More information about the jboss-dev-forums mailing list