Home » Modeling » EMF » XSDEcoreBuilder / EcoreRefletive Editor : Strange behavior with xsd:element without typetype
| | |
Re: XSDEcoreBuilder / EcoreRefletive Editor : Strange behavior with xsd:element without typetype [message #1694394 is a reply to message #1694355] |
Tue, 05 May 2015 05:25 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
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).
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: XSDEcoreBuilder / EcoreRefletive Editor : Strange behavior with xsd:element without typetype [message #1697082 is a reply to message #1694394] |
Mon, 01 June 2015 13:15 |
Philippe Favrais Messages: 23 Registered: April 2011 |
Junior Member |
|
|
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 13:28 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
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
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Goto Forum:
Current Time: Wed Sep 25 21:45:24 GMT 2024
Powered by FUDForum. Page generated in 0.03345 seconds
|