use of org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef in project tomee by apache.
the class SchemaCollection method addCrossImportsAttributeList.
private void addCrossImportsAttributeList(XmlSchema schema, List<XmlSchemaAttributeOrGroupRef> list) {
for (XmlSchemaAttributeOrGroupRef attr : list) {
final QName ref;
if (attr instanceof XmlSchemaAttribute) {
ref = ((XmlSchemaAttribute) attr).getRef().getTargetQName();
} else {
XmlSchemaAttributeGroupRef groupRef = (XmlSchemaAttributeGroupRef) attr;
ref = groupRef.getRef().getTargetQName();
}
if (ref != null) {
XmlSchemaUtils.addImportIfNeeded(schema, ref);
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef in project hale by halestudio.
the class XmlSchemaReader method createAttributesFromCollection.
private void createAttributesFromCollection(XmlSchemaObjectCollection attributeCollection, DefinitionGroup declaringType, String indexPrefix, String schemaLocation, String schemaNamespace) {
if (indexPrefix == null) {
// $NON-NLS-1$
indexPrefix = "";
}
for (int index = 0; index < attributeCollection.getCount(); index++) {
XmlSchemaObject object = attributeCollection.getItem(index);
if (object instanceof XmlSchemaAttribute) {
// <attribute ... />
XmlSchemaAttribute attribute = (XmlSchemaAttribute) object;
createAttribute(attribute, declaringType, schemaLocation, schemaNamespace);
} else if (object instanceof XmlSchemaAttributeGroup) {
XmlSchemaAttributeGroup group = (XmlSchemaAttributeGroup) object;
createAttributes(group, declaringType, indexPrefix + index, schemaLocation, schemaNamespace);
} else if (object instanceof XmlSchemaAttributeGroupRef) {
XmlSchemaAttributeGroupRef groupRef = (XmlSchemaAttributeGroupRef) object;
if (groupRef.getRefName() != null) {
QName groupName = groupRef.getRefName();
// XXX extend group name with namespace?
XmlAttributeGroupReferenceProperty property = new XmlAttributeGroupReferenceProperty(groupName, declaringType, this.index, groupName, true);
// TODO add constraints?
// set metadata
setMetadata(property, groupRef, schemaLocation);
} else {
reporter.error(new IOMessageImpl("Unrecognized attribute group reference", null, object.getLineNumber(), object.getLinePosition()));
}
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef in project cxf by apache.
the class SchemaCollection method addCrossImportsAttributeList.
private void addCrossImportsAttributeList(XmlSchema schema, List<XmlSchemaAttributeOrGroupRef> list) {
for (XmlSchemaAttributeOrGroupRef attr : list) {
final QName ref;
if (attr instanceof XmlSchemaAttribute) {
ref = ((XmlSchemaAttribute) attr).getRef().getTargetQName();
} else {
XmlSchemaAttributeGroupRef groupRef = (XmlSchemaAttributeGroupRef) attr;
ref = groupRef.getRef().getTargetQName();
}
if (ref != null) {
XmlSchemaUtils.addImportIfNeeded(schema, ref);
}
}
}
Aggregations