Java Code Examples for org.apache.ws.commons.schema.XmlSchemaComplexType#getName()
The following examples show how to use
org.apache.ws.commons.schema.XmlSchemaComplexType#getName() .
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: WSDLToCorbaHelper.java From cxf with Apache License 2.0 | 6 votes |
public boolean isLiteralArray(XmlSchemaComplexType type) { boolean array = false; if ((type.getAttributes().isEmpty()) && (type.getParticle() instanceof XmlSchemaSequence)) { XmlSchemaSequence stype = (XmlSchemaSequence)type.getParticle(); if ((stype.getItems().size() == 1) && (stype.getItems().get(0) instanceof XmlSchemaElement)) { XmlSchemaElement el = (XmlSchemaElement)stype.getItems().get(0); if (el.getMaxOccurs() != 1) { // it's a literal array array = true; } if (el.getMaxOccurs() == 1 && el.getMinOccurs() == 1 && type.getName() != null && WSDLTypes.isAnonymous(type.getName())) { array = true; } } } return array; }
Example 2
Source File: DidSchemaParser.java From secure-data-service with Apache License 2.0 | 6 votes |
/** * 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: DidSchemaParser.java From secure-data-service with Apache License 2.0 | 6 votes |
/** * Get the DidRefSource for a reference schema type */ DidRefSource getRefSource(XmlSchemaComplexType refSchema) { DidRefSource refSource = null; String schemaName = refSchema.getName(); if (refSourceCache.containsKey(schemaName)) { refSource = refSourceCache.get(schemaName); // if a cached refSource is found create return new DidRefSource of same type if (refSource != null) { DidRefSource cachedRefSource = refSource; refSource = new DidRefSource(); refSource.setEntityType(cachedRefSource.getEntityType()); } } else { XmlSchemaAnnotation annotation = refSchema.getAnnotation(); if (annotation == null) { LOG.debug("Annotation missing from refSchema: {}", refSchema.getName()); } else { refSource = parseAnnotationForRef(annotation); refSourceCache.put(schemaName, refSource); } } return refSource; }
Example 4
Source File: XsdToNeutralSchemaRepo.java From secure-data-service with Apache License 2.0 | 4 votes |
@SuppressWarnings("PMD.AvoidReassigningParameters") // makes code simpler private NeutralSchema parseComplexType(XmlSchemaComplexType schemaComplexType, NeutralSchema complexSchema, XmlSchema schema) { //if(complexSchema != null && complexSchema.getType() != null && complexSchema.getType().equals("application")) { //boolean isRequiredSchema = true; //for debugging //} if ((schemaComplexType.getContentModel() != null) && (schemaComplexType.getContentModel().getContent() != null)) { XmlSchemaContent content = schemaComplexType.getContentModel().getContent(); if (content instanceof XmlSchemaComplexContentExtension) { XmlSchemaComplexContentExtension schemaComplexContent = (XmlSchemaComplexContentExtension) content; XmlSchemaComplexType complexBaseType = getComplexBaseType(schemaComplexContent, schema); if (complexBaseType != null) { complexSchema = parseComplexType(complexBaseType, complexSchema, schema); } this.parseFields(schemaComplexContent, complexSchema, schema); } else if (content instanceof XmlSchemaSimpleContentExtension) { QName baseTypeName = ((XmlSchemaSimpleContentExtension) content).getBaseTypeName(); NeutralSchema simpleContentSchema = schemaFactory.createSchema(baseTypeName); complexSchema.addField(complexSchema.getType(), simpleContentSchema); parseAttributes(((XmlSchemaSimpleContentExtension) content).getAttributes(), complexSchema, schema); } } // Annotations are inherited by ComplexType fields so we need to parse these first. parseAnnotations(complexSchema, schemaComplexType); this.parseFields(schemaComplexType, complexSchema, schema); // Check for ChoiceSchemas. We only support complex types that contain choice if choice is // the ONLY element. If we find one, swap out the current ComplexSchema object that contains // this single choice schema for the actual choice schema itself. for (NeutralSchema ns : complexSchema.getFields().values()) { if (ns instanceof ChoiceSchema) { if (complexSchema.getFields().size() > 1 && !mergedChoiceSchemas.contains(ns)) { throw new RuntimeException( "Choice elements are only supported on complex objects with no other fields: " + schemaComplexType.getName()); } else if (!mergedChoiceSchemas.contains(ns)) { ns.setType(complexSchema.getType()); complexSchema.getAppInfo(); mergedChoiceSchemas.add(ns); if(ns.getType().equals("serviceDescriptorType")) { ns.addAnnotation(complexSchema.getAppInfo()); } return ns; } } } return complexSchema; }
Example 5
Source File: Xsd2CobolTypesModelBuilder.java From legstar-core2 with GNU Affero General Public License v3.0 | 2 votes |
/** * A complex type name is derived from an XML schema complex type name. * * @param xsdComplexType the XSD complex type * @return a unique type name for this complex type */ private static String getComplexTypeName(XmlSchemaComplexType xsdComplexType) { return xsdComplexType.getName(); }