Found a solution :
//The elem is the SchemaType variable
SchemaParticle rootSchemaParticle = elem.getContentModel();
SchemaLocalElement rootSchemaLocalElement = (SchemaLocalElement) rootSchemaParticle;
//Get the SchemaType for the element.
SchemaType rootSchemaType = rootSchemaLocalElement.getType();
//Get the content Model of the root Element ie; the Children Structure for elem
SchemaParticle childrenSchemaparticle = rootSchemaType.getContentModel();
if (childrenSchemaparticle != null) {// Operation has non zero child element
if (childrenSchemaparticle.countOfParticleChild() > 0) {// multiple child elements
for (int i = 0; i < childrenSchemaparticle
.countOfParticleChild(); i++) {
paraName = childrenSchemaparticle.getParticleChild(i).getName().getLocalPart();
SchemaLocalElement childSchemaLocalElement = (SchemaLocalElement) childrenSchemaparticle.getParticleChild(i);
minOccur = childSchemaLocalElement.getMinOccurs().longValue();
maxOccur = childSchemaLocalElement.getMaxOccurs().longValue();
SchemaType childSchemaType = childSchemaLocalElement.getType();
dataType = childSchemaType.getName().getLocalPart();
System.out.println("parameter Name "+paraName + " Datatype "+dataType+" Minoccur "+minOccur+" MaxOccur "+maxOccur);
}
} else {// Single child
paraName = childrenSchemaparticle.getName().getLocalPart();
minOccur = childrenSchemaparticle.getMinOccurs().longValue();
maxOccur = childrenSchemaparticle.getMaxOccurs().longValue();
SchemaLocalElement childSchemaLocalElement = (SchemaLocalElement) childrenSchemaparticle;
SchemaType childSchemaType = childSchemaLocalElement.getType();
dataType = childSchemaType.getName().getLocalPart();
System.out.println("parameter Name "+paraName + " Datatype "+dataType+" Minoccur "+minOccur+" MaxOccur "+maxOccur);
}
}
The Difference in handling the single child and multiple children is because of the difference in the type of the Particle , as it is ELEMENT for single child and SEQUENCE for the multiple childrens. Ref for details:http://xmlbeans.apache.org/docs/2.0.0/reference/org/apache/xmlbeans/SchemaParticle.html