XmlSchemaComplexType ctype = (XmlSchemaComplexType)type;
if (ctype.getAttributes().getCount() != 0) {
throw new RuntimeException("Cannot unwrap element " +
qname + ": attributes not allowed on type to be unwrapped");
}
XmlSchemaParticle particle = ctype.getParticle();
if (particle != null) {
// if there's a particle present, it must be a sequence
if (!(particle instanceof XmlSchemaSequence)) {
throw new RuntimeException("Cannot unwrap element " +
qname + ": type to be unwrapped must be a sequence");
}
if (particle.getMinOccurs() != 1 || particle.getMaxOccurs() != 1) {
throw new RuntimeException("Cannot unwrap element " +
qname + ": contained sequence must have minOccurs='1' and maxOccurs='1'");
}
XmlSchemaSequence sequence = (XmlSchemaSequence)particle;
// add child param element matching each child of wrapper element
QName opName = ((AxisOperation)msg.getParent()).getName();
XmlSchemaObjectCollection items = sequence.getItems();
boolean first = true;
for (Iterator iter = items.getIterator(); iter.hasNext();) {
// check that child item obeys the unwrapping rules
XmlSchemaParticle item = (XmlSchemaParticle)iter.next();
if (!(item instanceof XmlSchemaElement)) {
throw new RuntimeException("Cannot unwrap element " +
qname + ": only element items allowed in seqence");
}
XmlSchemaElement element = (XmlSchemaElement)item;