XmlSchemaObjectCollection attrs = null;
XmlSchemaObjectCollection members = null;
boolean readElement = false;
XmlSchemaObject stype = schemaType;
if (schemaType instanceof XmlSchemaElement) {
XmlSchemaElement el = (XmlSchemaElement) schemaType;
stype = el.getSchemaType();
if (stype == null) {
stype = CorbaUtils.getXmlSchemaType(serviceInfo, el.getRefName());
}
readElement = true;
}
if (stype instanceof XmlSchemaComplexType) {
XmlSchemaComplexType ctype = (XmlSchemaComplexType) stype;
attrs = ctype.getAttributes();
stype = ctype.getParticle();
readElement = true;
}
if (stype instanceof XmlSchemaGroupRef) {
members = ((XmlSchemaGroupRef) stype).getParticle().getItems();
} else if (stype instanceof XmlSchemaGroupBase) {
members = ((XmlSchemaGroupBase) stype).getItems();
}
QName elName;
if ((attrs != null) && (attrs.getCount() > 0)) {
elName = reader.peek().asStartElement().getName();
} else if (readElement) {
elName = reader.nextEvent().asStartElement().getName();
} else {
elName = CorbaUtils.EMPTY_QNAME;
}
obj = new CorbaStructHandler(elName, idlType, tc, structType);
List<MemberType> structMembers = structType.getMember();
int attrCount = 0;
int memberCount = 0;
for (int i = 0; i < structMembers.size(); ++i) {
XmlSchemaObject schemaObj;
if ((attrs != null) && (attrCount < attrs.getCount())) {
schemaObj = attrs.getItem(attrCount++);
} else {
schemaObj = members.getItem(memberCount++);
}