I need to use <any>
element in my xsd for scalability. So i used xsd as like below.
<complexType name="AddInput">
<sequence>
<element name="First" type="int"></element>
<element name="Sec" type="int"></element>
<any processContents="lax" namespace="##any" minOccurs="0" maxOccurs="unbounded"></any>
</sequence>
</complexType>
I have defined a complex object to place into the <any>
placeholder, with ObjectFactory (@XMLRegistry, @XmlElementDecl) But still if i run below code, i am getting
org.apache.xerces.dom.ElementNSImpl
instead of JAXBElementObject. I searched in google, i see that JAXBContext should know about the schema. But i am not sure, how to make JAXBContext know my complex object. Any idea would be helpful.
List<Object> elemList = (List<Object>)input.getAny();
for(Object elem : elemList){
System.out.println(elem.getClass());
}