Java Code Examples for org.apache.ws.commons.schema.XmlSchema#getItems()

The following examples show how to use org.apache.ws.commons.schema.XmlSchema#getItems() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ObjectReferenceVisitor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private boolean isReferenceSchemaTypeDefined(QName objectReferenceName,
                                             XmlSchema refSchema) {
    List<XmlSchemaObject> schemaObjects = refSchema.getItems();

    for (XmlSchemaObject schemaObj : schemaObjects) {
        if (schemaObj instanceof XmlSchemaElement) {
            XmlSchemaElement el = (XmlSchemaElement)schemaObj;

            if (el.getName().equals(objectReferenceName.getLocalPart())) {
                return true;
            }
        }
    }

    return false;
}
 
Example 2
Source File: DidSchemaParser.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
/**
 * extract all complex types from a schema and cache into a map
 */
private void cacheComplexTypes(XmlSchema schema) {
    XmlSchemaObjectCollection schemaItems = schema.getItems();

    int numElements = schemaItems.getCount();

    // Iterate XML Schema items
    for (int i = 0; i < numElements; i++) {
        XmlSchemaObject schemaObject = schemaItems.getItem(i);
        if (schemaObject instanceof XmlSchemaComplexType) {
            XmlSchemaComplexType complexType = (XmlSchemaComplexType) schemaObject;
            String elementTypeName = complexType.getName();
            complexTypes.put(elementTypeName, complexType);
        }
    }
}
 
Example 3
Source File: XsdToNeutralSchemaRepo.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
void loadSchema(XmlSchema schema) {
    XmlSchemaObjectCollection schemaItems = schema.getItems();

    // Iterate XML Schema items
    for (int i = 0; i < schemaItems.getCount(); i++) {
        XmlSchemaObject schemaObject = schemaItems.getItem(i);

        NeutralSchema neutralSchema;
        if (schemaObject instanceof XmlSchemaType) {
            neutralSchema = parse((XmlSchemaType) schemaObject, schema);
        } else if (schemaObject instanceof XmlSchemaElement) {
            neutralSchema = parseElement((XmlSchemaElement) schemaObject, schema);
        } else if (schemaObject instanceof XmlSchemaInclude) {
            continue; // nothing to do for includes
        } else {
            throw new RuntimeException("Unhandled XmlSchemaObject: " + schemaObject.getClass().getCanonicalName());
        }
        schemas.put(neutralSchema.getType(), neutralSchema);
        partialSchemas.clear();
    }
}