tags:

views:

48

answers:

0

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"&gt;
  <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 ?