Home » Modeling » EMF » XSDEcoreBuilder / EcoreRefletive Editor : Strange behavior with xsd:element without typetype
XSDEcoreBuilder / EcoreRefletive Editor : Strange behavior with xsd:element without typetype [message #1694339] |
Mon, 04 May 2015 11:04  |
Eclipse User |
|
|
|
In an XSD i have xsd:element declaration which have not type defined e.g.:FR_SM_CH and other having conplex type e.g. : FR_TP_CH
See the example
<xs:sequence>
<xs:element name="FR_SM_CH" minOccurs="0"/>
<xs:element name="FR_TP_CH" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="FR_TP_CHANNEL" minOccurs="0" maxOccurs="unbounded">
During the Ecore genration XsdEcoreBuilder maps as followning
<eStructuralFeatures xsi:type="ecore:EReference" name="fRSMCH" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"
containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="FR_SM_CH"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="fRTPCH" eType="#//FRTPCHType"
containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
<details key="name" value="FR_TP_CH"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
Now when i use the Using the EcoreREflective Editor, the popup menu Create NewChild is populated correctly for the XSD Element having a complex type but for the xsd:element having no type,
the corresponding subMenu is repeated many time while i would expect it only one
I don't know why? Does anybody already encountered that problem ?
Thank you in advance
Philippe
|
|
| | |
Re: XSDEcoreBuilder / EcoreRefletive Editor : Strange behavior with xsd:element without typetype [message #1694394 is a reply to message #1694355] |
Tue, 05 May 2015 01:25   |
Eclipse User |
|
|
|
Philippe,
Comments below.
On 04/05/2015 6:31 PM, Philippe Favrais wrote:
> Thank you Ed,
> indeed it is a long list...
> I see : element without type are interpreted as AnyType? Then, it
> proposes me all the global type.
Exactly.
> To workaround that behavior, i am thinking to bind that element to a
> complex type so that XsdEcoreBuilder bind this element (feature) to a
> well defined type (class)
> <xs:element name="FR_TRCV_CH" minOccurs="0">
> <xs:complexType>
> <xs:choice/>
> </xs:complexType>
> </xs:element>
>
> Is it a solution that seems correct ?
Yes that would do the trick. Of course such an object is kind of
pointless because it doesn't carry any data, but then I'm not sure the
intent of the original schema... What is the point of this element if
not to carry arbitrary complex type instances?
> Do you know how should i overwrite xsdEcoreBuilder to create such
> complex type for an existing Element ?
>
If you're really intent on doing that, i.e.,I'm not sure the point/goal;
you can of course change the schema exactly as you've show it. Of
course you can use the debugger to see how your example above is
processed and what's produced for it verses the original form, i.e.,
look at what happens in
org.eclipse.xsd.ecore.XSDEcoreBuilder.createFeature(EClass,
XSDElementDeclaration, String, XSDComponent, int, int).
|
|
|
Re: XSDEcoreBuilder / EcoreRefletive Editor : Strange behavior with xsd:element without typetype [message #1697082 is a reply to message #1694394] |
Mon, 01 June 2015 09:15   |
Eclipse User |
|
|
|
Hello Ed,
I come back to my problem with XSD which i let for a while.
In fact now i would like to identify all elements in my XSD files which have neither simple type nor complex type definition e.g. : <xs:element name="FR_SM_CH" minOccurs="0"/> : yes it doesn't carry any data
How can i find such elements ?
During my test, i expected that the returned type of such element would have been null !
XSDTypeDefinition elementTypeDefinition = getEffectiveTypeDefinition(xsdComponent, xsdElementDeclaration)
here is what i get : org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@415262a0 (element: [xs:complexType: null]) (name: anyType, targetNamespace: http://www.w3.org/2001/XMLSchema) (derivationMethod: <unset>, final: [], abstract: <unset>, contentTypeCategory: elementOnly, prohibitedSubstitutions: [extension, restriction], lexicalFinal: null, block: null, mixed: true)
Philippe
|
|
|
Re: XSDEcoreBuilder / EcoreRefletive Editor : Strange behavior with xsd:element without typetype [message #1697086 is a reply to message #1697082] |
Mon, 01 June 2015 09:28   |
Eclipse User |
|
|
|
Philippe,
Comments below.
On 01/06/2015 3:15 PM, Philippe Favrais wrote:
> Hello Ed,
>
> I come back to my problem with XSD which i let for a while.
> In fact now i would like to identify all elements in my XSD files
> which have neither simple type nor complex type definition e.g. :
> <xs:element name="FR_SM_CH" minOccurs="0"/> : yes it doesn't carry any
> data
> How can i find such elements ?
> During my test, i expected that the returned type of such element
> would have been null ! XSDTypeDefinition elementTypeDefinition =
> getEffectiveTypeDefinition(xsdComponent, xsdElementDeclaration)
> here is what i get :
> mailto:org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@415262a0
> (element: [xs:complexType: null]) (name: anyType, targetNamespace:
> http://www.w3.org/2001/XMLSchema) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: elementOnly,
> prohibitedSubstitutions: [extension, restriction], lexicalFinal: null,
> block: null, mixed: true)
Yes, the absence of a type attribute in the concrete model for an
element declaration is defined in the specification to be equivalent to
specifying "xsd:anyType" explicitly.
XSDUtil.isAnyType can be used to check if a type represents the anyType...
>
> Philippe
>
>
|
|
| |
Goto Forum:
Current Time: Thu Jul 10 10:27:25 EDT 2025
Powered by FUDForum. Page generated in 0.04418 seconds
|