element.setNillable(attribute.isNillable());
attribute.setNillable(attributeDescriptor.isNillable());
static XSDParticle particle(XSDSchema schema, String elementName, String typeNS, String typeName, boolean nillable, int minOccurs, int maxOccurs) { XSDFactory factory = XSDFactory.eINSTANCE; XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(elementName); element.setNillable(nillable); XSDTypeDefinition type = schema.resolveTypeDefinition(typeNS, typeName); element.setTypeDefinition(type); XSDParticle particle = factory.createXSDParticle(); particle.setMinOccurs(minOccurs); particle.setMaxOccurs(maxOccurs); particle.setContent(element); return particle; }
protected void makeReferenceElement(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition); XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(getName(reference)); if (reference.isUnsettable() && !reference.isMany()) { xsdElementDeclaration.setNillable(true); } setReferenceElementType(reference, xsdElementDeclaration); XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(xsdElementDeclaration); setReferenceElementMultiplicity(reference, particle); modelGroup.getContents().add(particle); map(particle, reference); }
protected void makeReferenceElement(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition); XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(getName(reference)); if (reference.isUnsettable() && !reference.isMany()) { xsdElementDeclaration.setNillable(true); } setReferenceElementType(reference, xsdElementDeclaration); XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(xsdElementDeclaration); setReferenceElementMultiplicity(reference, particle); modelGroup.getContents().add(particle); map(particle, reference); }
element.setNillable(attribute.isNillable());
protected XSDElementDeclaration buildGlobalElement(XSDSchema xsdSchema, EStructuralFeature eStructuralFeature) { XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(extendedMetaData.getName(eStructuralFeature)); EClassifier eType = eStructuralFeature.getEType(); XSDTypeDefinition xsdTypeDefinition = xsdSchema.resolveTypeDefinitionURI(getURI(eType)); handleImport(xsdSchema, xsdTypeDefinition); xsdElementDeclaration.setTypeDefinition(xsdTypeDefinition); if (isWrapperType(eType)) { xsdElementDeclaration.setNillable(true); } String defaultValue = eStructuralFeature.getDefaultValueLiteral(); if (defaultValue != null) { xsdElementDeclaration.setConstraint(XSDConstraint.DEFAULT_LITERAL); xsdElementDeclaration.setLexicalValue(defaultValue); } xsdSchema.getContents().add(xsdElementDeclaration); map(xsdElementDeclaration, eStructuralFeature); if (eStructuralFeature.eIsSet(EcorePackage.Literals.ETYPED_ELEMENT__EGENERIC_TYPE)) { createEcoreAnnotation(xsdElementDeclaration, "type", getGenericType(xsdSchema, eStructuralFeature.getEGenericType())); } buildAnnotations(xsdElementDeclaration, eStructuralFeature); return xsdElementDeclaration; }
protected void createAttributeElementDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition); XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(getName(attribute)); // If the attribute can have a null value (primitives and enums can't), and // if the attribute can hold many nulls or // it can hold only a single value that is allowed to be null // and it can be considered set when it has the null value... // if (attribute.getEType().getDefaultValue() == null && (attribute.isMany() || (!attribute.isRequired() && (attribute.getDefaultValueLiteral() != null || attribute.isUnsettable())))) { xsdElementDeclaration.setNillable(true); } if (xsdElementDeclaration.isNillable() || attribute.isMany() || !minimizedXMI) { XSDSimpleTypeDefinition attrType = getType(attribute.getEAttributeType()); if (attrType != null) { xsdElementDeclaration.setTypeDefinition(attrType); } XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(xsdElementDeclaration); setAttributeElementMultiplicity(attribute, particle); modelGroup.getContents().add(particle); map(particle, attribute); } }
protected void createAttributeElementDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition); XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(getName(attribute)); // If the attribute can have a null value (primitives and enums can't), and // if the attribute can hold many nulls or // it can hold only a single value that is allowed to be null // and it can be considered set when it has the null value... // if (attribute.getEType().getDefaultValue() == null && (attribute.isMany() || (!attribute.isRequired() && (attribute.getDefaultValueLiteral() != null || attribute.isUnsettable())))) { xsdElementDeclaration.setNillable(true); } if (xsdElementDeclaration.isNillable() || attribute.isMany() || !minimizedXMI) { XSDSimpleTypeDefinition attrType = getType(attribute.getEAttributeType()); if (attrType != null) { xsdElementDeclaration.setTypeDefinition(attrType); } XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(xsdElementDeclaration); setAttributeElementMultiplicity(attribute, particle); modelGroup.getContents().add(particle); map(particle, attribute); } }
element.setNillable(attribute.isNillable());
xsdElementDeclaration.setNillable(true);
(eStructuralFeature.getDefaultValueLiteral() != null || eStructuralFeature.isUnsettable()))))) xsdElementDeclaration.setNillable(true);
(eStructuralFeature.getDefaultValueLiteral() != null || eStructuralFeature.isUnsettable()))))) xsdElementDeclaration.setNillable(true);