private Map<String,SchemaObject> complexTypeName = new HashMap<>();
private Map<String,SchemaObject> simpleTypeName = new HashMap<>();
private Map<String,SchemaObject> modelGroupName = new HashMap<>();
+ private Map<String,SchemaObject> attrName = new HashMap<>();
private Map<Element,SchemaObject> elements = new HashMap<>();
private Map<ComplexType,SchemaObject> complexTypes = new HashMap<>();
private Map<SimpleType,SchemaObject> simpleTypes = new HashMap<>();
private Map<NamedGroup,SchemaObject> modelGroups = new HashMap<>();
+ private Map<Attribute,SchemaObject> attributes = new HashMap<>();
private SchemaObject _getWithName(QName name) {
SchemaObject obj = elementName.get(name.getLocalPart());
obj = complexTypeName.get(name.getLocalPart());
if (obj == null)
obj = simpleTypeName.get(name.getLocalPart());
+ if (obj == null)
+ obj = attrName.get(name.getLocalPart());
return obj;
}
SchemaObject obj = new SchemaObject(this,simpleType);
stack.push(obj);
} else if (attrs instanceof Attribute) {
- // Attributes are not cached
+ Attribute attribute = (Attribute)attrs;
+ SchemaObject obj = new SchemaObject(this, attribute);
+ stack.push(obj);
} else if (attrs instanceof AttributeGroup) {
// Attribute groups are not cached
} else if (attrs instanceof NamedGroup) {
modelGroups.put(e, object);
break;
}
+ case ATTRIBUTE: {
+ Attribute e = object.getAttribute();
+ attrName.put(e.getName(), object);
+ attributes.put(e, object);
+ break;
+ }
}
} // while
}
return type;
}
+ private SchemaObject _getAttribute(QName name) {
+ return attrName.get(name.getLocalPart());
+ }
+
protected Attribute getRefAttribute(QName ref) {
- for (OpenAttrs attrs : schema.getSimpleTypeOrComplexTypeOrGroup()) {
- if (attrs instanceof TopLevelAttribute) {
- TopLevelAttribute attribute = (TopLevelAttribute)attrs;
- if (attribute.getName().equals(ref.getLocalPart()))
- return attribute;
- }
+// for (OpenAttrs attrs : schema.getSimpleTypeOrComplexTypeOrGroup()) {
+// if (attrs instanceof TopLevelAttribute) {
+// TopLevelAttribute attribute = (TopLevelAttribute)attrs;
+// if (attribute.getName().equals(ref.getLocalPart()))
+// return attribute;
+// }
+// }
+ SchemaObject obj = _getAttribute(ref);
+ if (obj != null)
+ return obj.getAttribute();
+ if (ref.getNamespaceURI() != null) {
+ for (SchemaConverter sc : converter.getConverter(ref.getNamespaceURI())) {
+ if (sc.base != null) {
+ obj = sc.base._getAttribute(ref);
+ if (obj != null) {
+ return obj.getAttribute();
+ }
+ }
+ }
}
return null;
}