Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Export from GenModel to XSD missing lots of details
Export from GenModel to XSD missing lots of details [message #661569] Fri, 25 March 2011 12:04 Go to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Hi,

I have spotted something that I would be grateful if some-one could comment on. If I have a schema as follows:

	<xs:element name="myCarElement" type="Car"/>
	<xs:element name="carAttrs" type="Car" block="#all" final="#all" nillable="true" id="myID1"/>
	<xs:complexType name="Car">
		<xs:sequence>
			<xs:element name="colour" type="xs:string" minOccurs="4" maxOccurs="50"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="Bus">
		<xs:sequence>
			<xs:element name="route" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>


And use it to create an eCore and genModel, then from the genModel perform an export to XSD, it will return the following:

  <xsd:element name="carAttrs" type="complex:Car"/>
  <xsd:element name="myCarElement" type="complex:Car"/>
  <xsd:complexType name="Bus">
    <xsd:sequence>
      <xsd:element name="route" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="Car">
    <xsd:sequence>
      <xsd:element maxOccurs="50" minOccurs="4" name="colour" nillable="true" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>


Unfortunately this is not the same as the original schema. It appears that some data has been removed (restrictions on carAttrs) and others have add data added (nillable on colour). I have also seen minOccurs/maxOccurs be removed from xsd:any

Is there something that I have set up incorrectly that may be causing this?

Thanks

Rob
EMF: 2.4.2
Re: Export from GenModel to XSD missing lots of details [message #661617 is a reply to message #661569] Fri, 25 March 2011 15:14 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30551
Registered: July 2009
Senior Member
Rob,

Comments below.

Rob wrote:
> Hi,
>
> I have spotted something that I would be grateful if some-one could
> comment on. If I have a schema as follows:
>
> <xs:element name="myCarElement" type="Car"/>
> <xs:element name="carAttrs" type="Car" block="#all" final="#all"
> nillable="true" id="myID1"/>
> <xs:complexType name="Car">
> <xs:sequence>
> <xs:element name="colour" type="xs:string" minOccurs="4"
> maxOccurs="50"/>
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="Bus">
> <xs:sequence>
> <xs:element name="route" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
>
> And use it to create an eCore and genModel, then from the genModel
> perform an export to XSD, it will return the following:
>
> <xsd:element name="carAttrs" type="complex:Car"/>
> <xsd:element name="myCarElement" type="complex:Car"/>
> <xsd:complexType name="Bus">
> <xsd:sequence>
> <xsd:element name="route" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="Car">
> <xsd:sequence>
> <xsd:element maxOccurs="50" minOccurs="4" name="colour"
> nillable="true" type="xsd:string"/>
The nillable thing seems odd...
> </xsd:sequence>
> </xsd:complexType>
No one ever claimed that XSD -> Ecore -> XSD wouldn't be lossy. We try
to make Ecore -> XSD -> Ecore non-lossy, but XML Schema simply has way
too much baggage (that doesn't map to anything in Ecore) to try to
preserve it. After all, given you already have a schema, it's not
entirely clear why keeping the original schema isn't best anyway.
>
>
> Unfortunately this is not the same as the original schema. It appears
> that some data has been removed (restrictions on carAttrs) and others
> have add data added (nillable on colour). I have also seen
> minOccurs/maxOccurs be removed from xsd:any
Yes, that was recently fixed in the 2.7. stream.
>
> Is there something that I have set up incorrectly that may be causing
> this?
>
> Thanks
>
> Rob
> EMF: 2.4.2
>
Previous Topic:Omit type string in item provider getText
Next Topic:TableViewer binding
Goto Forum:
  


Current Time: Sat Oct 19 14:26:07 GMT 2019

Powered by FUDForum. Page generated in 0.02039 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top