Is it a jaxb bug?
Posted
by wd-shuang
on Stack Overflow
See other posts from Stack Overflow
or by wd-shuang
Published on 2010-05-24T03:21:13Z
Indexed on
2010/05/24
4:00 UTC
Read the original article
Hit count: 317
jaxb
I take a scheme, its element definition as follows:
<xs:complexType name="OriginalMessageContents1">
<xs:sequence>
<xs:any namespace="##any" processContents="skip"/>
<xs:any namespace="##any" processContents="skip" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
I use xjb to export java file,xjb as follow:
<jxb:bindings version="2.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:bindings schemaLocation="ibps.706.001.01.xsd" node="/xs:schema">
<jxb:bindings node="//xs:complexType[@name='OriginalMessageContents1']/xs:sequence">
<jxb:bindings node=".//xs:any[position()=1]">
<jxb:property name="anyOne"/>
</jxb:bindings>
<jxb:bindings node=".//xs:any[position()=2]">
<jxb:property name="anyTwo"/>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
Java as:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "OriginalMessageContents1", propOrder = {
"anyOne",
"anyTwo"
})
public class OriginalMessageContents1 {
@XmlAnyElement
protected Element anyOne;
@XmlAnyElement
protected Element anyTwo;
public Element getAnyOne() {
return anyOne;
}
public void setAnyOne(Element value) {
this.anyOne = value;
}
public Element getAnyTwo() {
return anyTwo;
}
public void setAnyTwo(Element value) {
this.anyTwo = value;
}
}
When I unmashaller this object by using getAnyOne,I get the contents of the second element. I got null by using getAnyTwo.
It is a bug? Anybody can help me ?
© Stack Overflow or respective owner