## org.eclipse.xsd.ecore
Class EcoreXMLSchemaBuilder

    java.lang.Object
      org.eclipse.xsd.ecore.NameMangler
          org.eclipse.xsd.ecore.MapBuilder
              org.eclipse.xsd.ecore.EcoreXMLSchemaBuilder

Direct Known Subclasses:
  EcoreXMISchemaBuilder

    public class EcoreXMLSchemaBuilder

extends MapBuilder

This class produces an XSDSchema given an Ecore EPackage. The XSDSchema is an XML schema.

Nested Class Summary
`static interface` `EcoreXMLSchemaBuilder.QNameMap`

Nested classes/interfaces inherited from class org.eclipse.xsd.ecore.MapBuilder
`MapBuilder.Mapper`

Field Summary
`protected java.util.Map<java.lang.String,java.lang.String>` `ecoreToSchemaName`
`protected static java.lang.String` `EMF_SCHEMA_NAME`
`protected static java.lang.String` `EMF_SCHEMA_PREFIX`
`protected static java.lang.String` `EMF_SCHEMA_URI`
`protected XSDSchema` `emfSchema`
`protected boolean` `enforceLowerBound`
`protected EPackage` `ePackage`
`protected java.util.Map<EPackage,java.lang.String>` `ePackageToNsPrefixMap`
`protected java.util.Map<EPackage,XSDSchema>` `ePackageToXSDSchemaMap`
`protected boolean` `minimizedXMI`
`static java.lang.String` `OPTION_TO_ENFORCE_LOWERBOUND`
`static java.lang.String` `OPTION_USE_ENCODED_ATTRIBUTE_STYLE`
`protected EcoreXMLSchemaBuilder.QNameMap` `qNameMap`
`protected static java.lang.String` `REFERENCE_TYPE_NAME`
`protected java.util.List<EClass>` `rootClasses`
`protected boolean` `useEncodedAttributeStyle`
`protected XSDParser` `xsdParser`
`protected XSDSchema` `xsdSchema`

Fields inherited from class org.eclipse.xsd.ecore.MapBuilder
`mapper, xsdComponentToEModelElementMap`

Fields inherited from class org.eclipse.xsd.ecore.NameMangler
`DOMAINS, LOWER_CASE, UNCHANGED_CASE, UPPER_CASE`

Constructor Summary
`EcoreXMLSchemaBuilder()`

Method Summary
`protected void` `addDocumentation(XSDConcreteComponent xsdComponent, EModelElement eModelElement)`
`protected void` `addEMFSchema()`
`protected void` `addImport(java.lang.String namespace, java.lang.String schemaLocation)`
`protected void` `additionalProcessing(EClass cls, XSDComplexTypeDefinition xsdComplexTypeDefinition)`
`protected void` `createAttributeDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition)`
`protected void` `createAttributeElementDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition)`
`protected void` `createEMFSchema()`
`protected XSDModelGroup` `createModelGroup(XSDComplexTypeDefinition xsdComplexTypeDefinition)`
`protected void` `createOtherSchema(EPackage ePackage)`
`protected void` `createSchema()`
`java.util.Collection<EObject>` `generate(EPackage ePackage)`
`java.util.Collection<EObject>` `generate(EPackage ePackage, EcoreXMLSchemaBuilder.QNameMap qNameMap)`
`protected java.util.List<EStructuralFeature>` `getAllFeatures(EClass eClass, java.util.Set<EClass> classesToIgnore)` This method returns the list of features for the given class and all inherited features; ignoring features from classes in the classesToIgnore set.
`protected java.util.List<EStructuralFeature>` `getFeatures(EClass eClass, java.util.List<EClass> superClasses)` Return the inherited features from the super classes (except the first one, which is the base type for the generated schema type for the class), and the local features.
`protected XSDModelGroup` `getModelGroup(XSDComplexTypeDefinition xsdComplexTypeDefinition)` Returns the model group for the given complex type definition.
`protected java.lang.String` `getName(ENamedElement element)` Return the given name, or the name from the XMLMap, if there is one.
`protected XSDSimpleTypeDefinition` `getType(EDataType dataType)`
`protected java.lang.String` `getUniqueNsPrefix(EPackage ePackage)`
`protected boolean` `makeAttributeDeclaration(EAttribute attribute)`
`protected boolean` `makeAttributeElementDeclaration(EAttribute attribute)`
`protected boolean` `makeClassElementDeclaration(EClass eClass)`
`protected boolean` `makeReferenceAttribute(EReference reference)`
`protected void` `makeReferenceAttribute(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition)`
`protected boolean` `makeReferenceElement(EReference reference)`
`protected void` `makeReferenceElement(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition)`
`protected boolean` `processAttribute(EAttribute attribute)`
`protected void` `processAttribute(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition)` Map each EAttribute to an XML attribute declaration in the complex type corresponding to the class, or an XML element declaration, depending on the multiplicity of the EAttribute.
`protected void` `processClass(EClass eClass)` Map each EClass to a schema complex type and an element declaration of that type; the names of the complex type and element declaration are the name of the class.
`protected void` `processClasses()`
`protected void` `processEnum(EEnum eEnum)` Each EEnum is mapped to a schema simple type that restricts the string simple type; the schema type has an enumeration facet for each EEnumLiteral.
`protected void` `processEnums()`
`protected void` `processReference(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition)`
`protected void` `setAttributeElementMultiplicity(EAttribute attribute, XSDParticle particle)`
`protected void` `setAttributeType(EAttribute attribute, XSDAttributeDeclaration attrDecl)`
`protected void` `setDefaultValue(EAttribute attribute, XSDAttributeDeclaration attrDecl)`
`protected void` `setReferenceAttribType(XSDAttributeDeclaration xsdAttributeDeclaration)`
`protected void` `setReferenceElementMultiplicity(EReference reference, XSDParticle particle)`
`protected void` `setReferenceElementType(EReference reference, XSDElementDeclaration xsdElementDeclaration)`
`protected void` `setUseToRequired(EAttribute attribute, XSDAttributeUse attrUse)`
`protected boolean` `skipReference(EReference reference)`
`protected XSDTypeDefinition` `typeInOtherSchema(EClassifier classifier)`

Methods inherited from class org.eclipse.xsd.ecore.MapBuilder
`addInput, addOutput, map, setMapper`

Methods inherited from class org.eclipse.xsd.ecore.NameMangler
`parseName, qualifiedPackageName, uncapName, validName, validName, validName`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### OPTION_TO_ENFORCE_LOWERBOUND

    public static final java.lang.String OPTION_TO_ENFORCE_LOWERBOUND

See Also:
  Constant Field Values

### OPTION_USE_ENCODED_ATTRIBUTE_STYLE

    public static final java.lang.String OPTION_USE_ENCODED_ATTRIBUTE_STYLE

See Also:
  Constant Field Values

### EMF_SCHEMA_URI

    protected static final java.lang.String EMF_SCHEMA_URI

See Also:
  Constant Field Values

### EMF_SCHEMA_PREFIX

    protected static final java.lang.String EMF_SCHEMA_PREFIX

See Also:
  Constant Field Values

### EMF_SCHEMA_NAME

    protected static final java.lang.String EMF_SCHEMA_NAME

See Also:
  Constant Field Values

### REFERENCE_TYPE_NAME

    protected static final java.lang.String REFERENCE_TYPE_NAME

See Also:
  Constant Field Values

### xsdSchema

    protected XSDSchema xsdSchema

### emfSchema

    protected XSDSchema emfSchema

### ePackage

    protected EPackage ePackage

### ecoreToSchemaName

    protected java.util.Map<java.lang.String,java.lang.String> ecoreToSchemaName

### ePackageToXSDSchemaMap

    protected java.util.Map<EPackage,XSDSchema> ePackageToXSDSchemaMap

### ePackageToNsPrefixMap

    protected java.util.Map<EPackage,java.lang.String> ePackageToNsPrefixMap

### qNameMap

    protected EcoreXMLSchemaBuilder.QNameMap qNameMap

### minimizedXMI

    protected boolean minimizedXMI

### useEncodedAttributeStyle

    protected boolean useEncodedAttributeStyle

### enforceLowerBound

    protected boolean enforceLowerBound

### rootClasses

    protected java.util.List<EClass> rootClasses

### xsdParser

    protected XSDParser xsdParser

Constructor Detail

### EcoreXMLSchemaBuilder

    public EcoreXMLSchemaBuilder()

Method Detail

### generate

    public java.util.Collection<EObject> generate(EPackage ePackage)

### generate

    public java.util.Collection<EObject> generate(EPackage ePackage,
                                                  EcoreXMLSchemaBuilder.QNameMap qNameMap)

### getUniqueNsPrefix

    protected java.lang.String getUniqueNsPrefix(EPackage ePackage)

### createSchema

    protected void createSchema()

### createEMFSchema

    protected void createEMFSchema()

### addEMFSchema

    protected void addEMFSchema()

### typeInOtherSchema

    protected XSDTypeDefinition typeInOtherSchema(EClassifier classifier)

### addImport

    protected void addImport(java.lang.String namespace,
                             java.lang.String schemaLocation)

### createOtherSchema

    protected void createOtherSchema(EPackage ePackage)

### processClasses

    protected void processClasses()

### processEnums

    protected void processEnums()

### getName

    protected java.lang.String getName(ENamedElement element)

  Return the given name, or the name from the XMLMap, if there is one.

### processEnum

    protected void processEnum(EEnum eEnum)

  Each EEnum is mapped to a schema simple type that restricts the string simple type; the schema type has an enumeration facet for each EEnumLiteral.

### processClass

    protected void processClass(EClass eClass)

  Map each EClass to a schema complex type and an element declaration of that type; the names of the complex type and element declaration are the name of the class. If the class is abstract, only a complex type is created from it; there is no corresponding element declaration.

### makeClassElementDeclaration

    protected boolean makeClassElementDeclaration(EClass eClass)

### additionalProcessing

    protected void additionalProcessing(EClass cls,
                                        XSDComplexTypeDefinition xsdComplexTypeDefinition)

### getFeatures

    protected java.util.List<EStructuralFeature> getFeatures(EClass eClass,
                                                             java.util.List<EClass> superClasses)

  Return the inherited features from the super classes (except the first one, which is the base type for the generated schema type for the class), and the local features.

### getAllFeatures

    protected java.util.List<EStructuralFeature> getAllFeatures(EClass eClass,
                                                                java.util.Set<EClass> classesToIgnore)

  This method returns the list of features for the given class and all inherited features; ignoring features from classes in the classesToIgnore set.

### processAttribute

    protected void processAttribute(EAttribute attribute,
                                    XSDComplexTypeDefinition xsdComplexTypeDefinition)

  Map each EAttribute to an XML attribute declaration in the complex type corresponding to the class, or an XML element declaration, depending on the multiplicity of the EAttribute.

  The types are mapped as follows: Ecore type Schema type ------------ ------------- EBoolean boolean EBooleanObject boolean EInt int EIntegerObject int ELong long ELongObject long EFloat float EFloatObject float EDouble double EDoubleObject double EString string

  If the attribute has no type or if the type is an EDataType that is not an EEnum, the schema string type is used.

  If the EAttribute is required, the attribute declaration includes use="required".

  If the EAttribute has a defaultValueLiteral, the attribute declaration has a default attribute whose value is the defaultValueLiteral.

  If the EAttribute is transient, or its type is not serializable, an attribute declaration is not generated.

  If the EAttribute can have many values, an element declaration is created rather than an attribute declaration. The lower bound of the attribute is set to the minOccurs value of the element declaration. The upper bound of the attribute is set to the maxOccurs value of the element declaration (converting -1 to unbounded as appropriate). The type of the element is set as above for attribute declarations.

### createAttributeDeclaration

    protected void createAttributeDeclaration(EAttribute attribute,
                                              XSDComplexTypeDefinition xsdComplexTypeDefinition)

### createAttributeElementDeclaration

    protected void createAttributeElementDeclaration(EAttribute attribute,
                                                     XSDComplexTypeDefinition xsdComplexTypeDefinition)

### setAttributeElementMultiplicity

    protected void setAttributeElementMultiplicity(EAttribute attribute,
                                                   XSDParticle particle)

### processAttribute

    protected boolean processAttribute(EAttribute attribute)

### makeAttributeDeclaration

    protected boolean makeAttributeDeclaration(EAttribute attribute)

### makeAttributeElementDeclaration

    protected boolean makeAttributeElementDeclaration(EAttribute attribute)

### getModelGroup

    protected XSDModelGroup getModelGroup(XSDComplexTypeDefinition xsdComplexTypeDefinition)

  Returns the model group for the given complex type definition. If there is no model group, a model group is created and added to the complex type definition.

### createModelGroup

    protected XSDModelGroup createModelGroup(XSDComplexTypeDefinition xsdComplexTypeDefinition)

### setAttributeType

    protected void setAttributeType(EAttribute attribute,
                                    XSDAttributeDeclaration attrDecl)

### setUseToRequired

    protected void setUseToRequired(EAttribute attribute,
                                    XSDAttributeUse attrUse)

### setDefaultValue

    protected void setDefaultValue(EAttribute attribute,
                                   XSDAttributeDeclaration attrDecl)

### processReference

    protected void processReference(EReference reference,
                                    XSDComplexTypeDefinition xsdComplexTypeDefinition)

### makeReferenceAttribute

    protected boolean makeReferenceAttribute(EReference reference)

### makeReferenceElement

    protected boolean makeReferenceElement(EReference reference)

### skipReference

    protected boolean skipReference(EReference reference)

### makeReferenceAttribute

    protected void makeReferenceAttribute(EReference reference,
                                          XSDComplexTypeDefinition xsdComplexTypeDefinition)

### setReferenceAttribType

    protected void setReferenceAttribType(XSDAttributeDeclaration xsdAttributeDeclaration)

### makeReferenceElement

    protected void makeReferenceElement(EReference reference,
                                        XSDComplexTypeDefinition xsdComplexTypeDefinition)

### setReferenceElementType

    protected void setReferenceElementType(EReference reference,
                                           XSDElementDeclaration xsdElementDeclaration)

### setReferenceElementMultiplicity

    protected void setReferenceElementMultiplicity(EReference reference,
                                                   XSDParticle particle)

### getType

    protected XSDSimpleTypeDefinition getType(EDataType dataType)

### addDocumentation

    protected void addDocumentation(XSDConcreteComponent xsdComponent,
                                    EModelElement eModelElement)

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.