Search in sources :

Example 1 with XmlSchemaAttributeGroupRef

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);
        }
    }
}
Also used : QName(javax.xml.namespace.QName) XmlSchemaAttribute(org.apache.ws.commons.schema.XmlSchemaAttribute) XmlSchemaAttributeOrGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeOrGroupRef) XmlSchemaAttributeGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef)

Example 2 with XmlSchemaAttributeGroupRef

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()));
            }
        }
    }
}
Also used : XmlAttributeGroupReferenceProperty(eu.esdihumboldt.hale.io.xsd.reader.internal.XmlAttributeGroupReferenceProperty) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) QName(javax.xml.namespace.QName) XmlSchemaAttributeGroup(org.apache.ws.commons.schema.XmlSchemaAttributeGroup) IOMessageImpl(eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl) XmlSchemaAttribute(org.apache.ws.commons.schema.XmlSchemaAttribute) XmlSchemaAttributeGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef)

Example 3 with XmlSchemaAttributeGroupRef

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);
        }
    }
}
Also used : QName(javax.xml.namespace.QName) XmlSchemaAttribute(org.apache.ws.commons.schema.XmlSchemaAttribute) XmlSchemaAttributeOrGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeOrGroupRef) XmlSchemaAttributeGroupRef(org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef)

Aggregations

QName (javax.xml.namespace.QName)3 XmlSchemaAttribute (org.apache.ws.commons.schema.XmlSchemaAttribute)3 XmlSchemaAttributeGroupRef (org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef)3 XmlSchemaAttributeOrGroupRef (org.apache.ws.commons.schema.XmlSchemaAttributeOrGroupRef)2 IOMessageImpl (eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl)1 XmlAttributeGroupReferenceProperty (eu.esdihumboldt.hale.io.xsd.reader.internal.XmlAttributeGroupReferenceProperty)1 XmlSchemaAttributeGroup (org.apache.ws.commons.schema.XmlSchemaAttributeGroup)1 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)1