in src/main/java/org/apache/ws/commons/schema/XmlSchema.java [668:701]
protected XmlSchemaElement getElementByName(QName name, boolean deep, Stack<XmlSchema> schemaStack) {
if (schemaStack != null && schemaStack.contains(this)) {
// recursive schema - just return null
return null;
}
XmlSchemaElement element = elements.get(name);
if (deep) {
if (element == null) {
// search the imports
for (XmlSchemaExternal item : externals) {
XmlSchema schema = getSchema(item);
if (schema != null) {
// create an empty stack - push the current parent in
// and
// use the protected method to process the schema
if (schemaStack == null) {
schemaStack = new Stack<XmlSchema>();
}
schemaStack.push(this);
element = schema.getElementByName(name, deep, schemaStack);
if (element != null) {
return element;
}
}
}
} else {
return element;
}
}
return element;
}