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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...