ComplexContentHandler cch = (ComplexContentHandler) child;
if (cch.getChild() instanceof ExtensionHandler) {
ExtensionHandler ext = (ExtensionHandler) cch.getChild();
ComplexType ct = parent.lookUpComplexType(ext.getBase());
dct.parent = ct;
// attributes
if (ct!=null && ct.getAttributes() != null) {
Attribute[] it = ct.getAttributes();
for (int i = 0; i < it.length; i++) {
attr.add(it[i]);
}
}
if (ext.getAttributeDeclarations() != null) {
Iterator it = ext.getAttributeDeclarations().iterator();
while (it.hasNext()) {
Object o = it.next();
if (o instanceof AttributeHandler) {
AttributeHandler ah = (AttributeHandler) o;
attr.add(ah.compress(parent));
} else {
AttributeGroupHandler agh = (AttributeGroupHandler) o;
AttributeGroup ag = agh.compress(parent);
attr.addAll(Arrays.asList(ag.getAttributes()));
}
}
}
if (ct!=null && ext.getChild() != null) {
logger.finest("Looked up " + ext.getBase()
+ " and found "
+ ((ct == null) ? null
: (ct.getName() + ":::"
+ ct.getNamespace())) + " for " + name);
ElementGrouping extensionBaseType = ct.getChild();
ElementGrouping extensionChild = ((ElementGroupingHandler)ext.getChild()).compress(parent);
dct.child = loadNewEG(extensionBaseType,extensionChild, parent); // note should override element def only ... not spot
} else {
if (ct != null)
dct.child = ct.getChild();
}
} else {
//restriction
RestrictionHandler ext = (RestrictionHandler) cch.getChild();