Java Code Examples for org.apache.ws.commons.schema.XmlSchemaElement#getMaxOccurs()
The following examples show how to use
org.apache.ws.commons.schema.XmlSchemaElement#getMaxOccurs() .
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: ParticleInfo.java From cxf with Apache License 2.0 | 6 votes |
/** * Create element information for a part element. For a part, the JavaScript * and Element names are calculated in advance, and the element itself might * be null! In that case, the minOccurs and maxOccurs are conventional. Note * that in some cases the code in ServiceJavascriptBuilder uses a local * element (or xa:any) from inside the part element, instead of the part * element itself. * * @param element the element, or null * @param schemaCollection the schema collection, for resolving types. * @param javascriptName javascript variable name * @param xmlElementName xml element string * @return */ public static ParticleInfo forPartElement(XmlSchemaElement element, SchemaCollection schemaCollection, String javascriptName, String xmlElementName) { ParticleInfo elementInfo = new ParticleInfo(); elementInfo.particle = element; if (element == null) { elementInfo.minOccurs = 1; elementInfo.maxOccurs = 1; } else { elementInfo.minOccurs = element.getMinOccurs(); elementInfo.maxOccurs = element.getMaxOccurs(); elementInfo.nillable = element.isNillable(); factorySetupType(element, schemaCollection, elementInfo); } elementInfo.javascriptName = javascriptName; elementInfo.xmlName = xmlElementName; elementInfo.global = true; return elementInfo; }
Example 3
Source File: Xsd2CobolTypesModelBuilder.java From legstar-core2 with GNU Affero General Public License v3.0 | 5 votes |
private Map < String, Object > getProps(int fieldIndex, XmlSchemaElement xsdElement, RootCompositeType compositeTypes) { Map < String, Object > props; CobolAnnotations cobolAnnotations = new CobolAnnotations(xsdElement); if (xsdElement.getSchemaType() instanceof XmlSchemaComplexType) { props = getProps((XmlSchemaComplexType) xsdElement.getSchemaType(), compositeTypes); } else if (xsdElement.getSchemaType() instanceof XmlSchemaSimpleType) { props = getProps((XmlSchemaSimpleType) xsdElement.getSchemaType(), cobolAnnotations); if (props.get(ODO_OBJECT_PROP_NAME) != null) { odoObjectNames.put(cobolAnnotations.getCobolName(), getFieldName(xsdElement)); } } else { throw new Xsd2ConverterException("Unsupported xsd element of type " + xsdElement.getSchemaType().getQName() + " at line " + xsdElement.getLineNumber()); } if (xsdElement.getMaxOccurs() > 1) { addArrayProps(xsdElement, cobolAnnotations, props); } if (xsdElement.getMinOccurs() == 0 && xsdElement.getMaxOccurs() == 1) { addOptionalProps(xsdElement, cobolAnnotations, props); } props.put(COBOL_NAME_PROP_NAME, cobolAnnotations.getCobolName()); props.put(FIELD_INDEX_PROP_NAME, fieldIndex); return props; }
Example 4
Source File: ParticleInfo.java From cxf with Apache License 2.0 | 5 votes |
/** * Create an elementInfo that stores information about a global, named, * element. * * @param element the element * @param currentSchema the schema it came from. * @param schemaCollection the collection of all schemas. * @param prefixAccumulator the accumulator that assigns prefixes. * @return */ public static ParticleInfo forGlobalElement(XmlSchemaElement element, XmlSchema currentSchema, SchemaCollection schemaCollection, NamespacePrefixAccumulator prefixAccumulator) { ParticleInfo elementInfo = new ParticleInfo(); elementInfo.particle = element; elementInfo.minOccurs = element.getMinOccurs(); elementInfo.maxOccurs = element.getMaxOccurs(); elementInfo.nillable = element.isNillable(); elementInfo.global = true; factoryCommon(element, currentSchema, schemaCollection, prefixAccumulator, elementInfo); return elementInfo; }
Example 5
Source File: CommonsSchemaInfoBuilder.java From tomee with Apache License 2.0 | 5 votes |
private static XmlElementInfo createXmlElementInfo(QName qname, QName xmlType, XmlSchemaElement element) { XmlElementInfo elementInfo = new XmlElementInfo(); elementInfo.qname = qname; elementInfo.xmlType = xmlType; elementInfo.minOccurs = element.getMinOccurs(); elementInfo.maxOccurs = element.getMaxOccurs(); elementInfo.nillable = element.isNillable(); return elementInfo; }
Example 6
Source File: XsdToNeutralSchemaRepo.java From secure-data-service with Apache License 2.0 | 4 votes |
private NeutralSchema parseElement(XmlSchemaElement element, XmlSchema schema) { QName elementTypeName = element.getSchemaTypeName(); // Derive Element Schema XmlSchemaType elementSchemaType = element.getSchemaType(); // Element annotations override type annotations. if (element.getAnnotation() != null) { elementSchemaType.setAnnotation(element.getAnnotation()); } NeutralSchema elementSchema = null; if (elementSchemaType != null) { if (elementSchemaType.getName() != null) { elementSchema = this.parse(elementSchemaType, schema); } else { elementSchema = this.parse(elementSchemaType, element.getName(), schema); } } else if (elementTypeName != null) { elementSchema = getSchemaFactory().createSchema(elementTypeName); } if (elementSchema != null) { // List Schema if (element.getMaxOccurs() > 1) { ListSchema listSchema = (ListSchema) getSchemaFactory().createSchema("list"); listSchema.getList().add(elementSchema); listSchema.updateAnnotations(); elementSchema = listSchema; } } Long min = element.getMinOccurs(); Long max = element.getMaxOccurs(); QName type = element.getSchemaTypeName(); if(min != null) { elementSchema.getProperties().put("minCardinality", min); } if( max != null) { elementSchema.getProperties().put("maxCardinality", max); } if(type != null) { elementSchema.getProperties().put("elementType", type.toString()); } return elementSchema; }