* @param comptoclas map from schema component to corresponding {@link ClassHolder}
* @param refcomps set of schema global definitions incorporated into this tree
* @param uritoprefix map from namespaces used by referenced definitions to the corresponding prefixes
*/
private void scanItemTree(GroupItem group, Map comptoclas, Set refcomps, Map uritoprefix) {
OpenAttrBase topcomp = group.getSchemaComponent();
for (Item item = group.getFirstChild(); item != null; item = item.getNext()) {
if (!item.isIgnored()) {
// start by checking if we've crossed into a different schema definition
OpenAttrBase comp = item.getSchemaComponent();
while (comp != topcomp) {
if (comp.isGlobal()) {
if (!(item instanceof ReferenceItem)) {
refcomps.add(comp);
}
QName qname = ((INamed)comp).getQName();
if (qname == null) {
throw new IllegalStateException("Internal error - no name on global definition");
} else {
uritoprefix.put(qname.getUri(), qname.getPrefix());
}
break;
} else {
comp = comp.getParent();
}
}
// now check the actual item type
if (item instanceof GroupItem) {
// check non-inlined group which uses separate class
GroupItem childgroup = (GroupItem)item;
if (!childgroup.isIgnored()) {
if (childgroup.isInline()) {
scanItemTree(childgroup, comptoclas, refcomps, uritoprefix);
} else {
// add component to class mapping to stop schema fragment generation when reached
TypeData genclas = childgroup.getGenerateClass();
if (genclas == null) {
throw new IllegalStateException("Internal error - no generate class");
} else {
comptoclas.put(childgroup.getSchemaComponent(), genclas);
}
// check for type definition or reference used (with associated namespace reference)
QName tname = null;
comp = item.getSchemaComponent();
switch (comp.type()) {
case SchemaBase.ATTRIBUTE_TYPE:
tname = ((AttributeElement)comp).getType();
break;
case SchemaBase.ELEMENT_TYPE:
tname = ((ElementElement)comp).getType();