Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Elementary types importing from XSD into Ecore
Elementary types importing from XSD into Ecore [message #396883] Fri, 18 November 2005 21:28
pietro contini is currently offline pietro contini
Messages: 6
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.

------=_NextPart_000_003E_01C5EC44.00E1DAA0
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hi,

I imported in EMF an XSD file with this part inside:

<xsd:complexType name=3D"vector">
<xsd:sequence>
<xsd:element name=3D"x" type=3D"xsd:double"/>
<xsd:element name=3D"y" type=3D"xsd:double"/>
<xsd:element name=3D"z" type=3D"xsd:double"/>
</xsd:sequence>
</xsd:complexType>

I worked on my model and then I exported again the data in XSD format =
(by "Generate Schema" function of genmodel).

I obtained this (regarding the part above):

<xsd:complexType name=3D"Vector">
<xsd:attribute name=3D"x" type=3D"xsd:string" use=3D"required"/>
<xsd:attribute name=3D"y" type=3D"xsd:string" use=3D"required"/>
<xsd:attribute name=3D"z" type=3D"xsd:string" use=3D"required"/>
</xsd:complexType>

the simple types "xsd:double" of my original XSD have been translated in =
"xsd:string",
and the original xsd:element name=3D"x".... have been translated into =
xsd:attribute.

To re-obtain the types "double" (and not "string"), I had to change in =
the ecore model the type of "x"... from Double into EDouble.

I have to change the elementaty types into ETypes for all my entities, =
or is there an easier way to obtain in output an XSD more adherent to =
the input one ?

Thanks a lot.

Best Regards.

Pietro


------=_NextPart_000_003E_01C5EC44.00E1DAA0
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.2800.1491" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I imported in EMF an XSD file with =
this&nbsp;part=20
inside:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
&lt;xsd:complexType name=3D"vector"&gt;<BR>&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &lt;xsd:sequence&gt;<BR>&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;xsd:element name=3D"x"=20
type=3D"xsd:double"/&gt;<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;xsd:element name=3D"y"=20
type=3D"xsd:double"/&gt;<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;xsd:element name=3D"z"=20
type=3D"xsd:double"/&gt;<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence&gt;<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &lt;/xsd:complexType&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I worked on my model and then I =
exported again the=20
data in XSD format (by "Generate Schema" function of =
genmodel).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I obtained this (regarding the part=20
above):</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#333399 size=3D2><FONT=20
color=3D#000000>&lt;xsd:complexType =
name=3D"Vector"&gt;<BR>&lt;xsd:attribute=20
name=3D"x" type=3D"<FONT color=3D#ff0000>xsd:string</FONT>"=20
use=3D"required"/&gt;<BR>&lt;xsd:attribute name=3D"y" type=3D"<FONT=20
color=3D#ff0000>xsd:string</FONT>" =
use=3D"required"/&gt;<BR>&lt;xsd:attribute=20
name=3D"z" type=3D"<FONT color=3D#ff0000>xsd:string</FONT>"=20
use=3D"required"/&gt;<BR>&lt;/xsd:complexType</FONT >&gt;</FONT></DIV>
<DIV><FONT face=3DArial color=3D#333399 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>the simple types "xsd:double" of my =
original XSD=20
have been translated in "xsd:string",</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>and the original xsd:element =
name=3D"x".... have been=20
translated into xsd:attribute.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>To re-obtain the types "double" (and =
not "string"),=20
I had to change in the ecore model the type of "x"... from Double into=20
EDouble.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have to change the elementaty types =
into ETypes=20
for all my entities, or is there an easier way to obtain in output an =
XSD more=20
adherent to the input one ?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks a lot.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Best Regards.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Pietro</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</FONT></DIV></BODY></HTML>

------=_NextPart_000_003E_01C5EC44.00E1DAA0--
Re: Elementary types importing from XSD into Ecore [message #396886 is a reply to message #396883] Fri, 18 November 2005 12:48 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26045
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090009040509050908010308
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit

Pietro,

We are working on improved support that will take extended meta data
annotations into account and that will generate appropriate simple type
definitions:

93194 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=93194>

The focus is on being able to round trip Ecore -> XSD ->Ecore. In
general XSD -> Ecore is somewhat lossy, so XSD -> Ecore -> XSD will
never be a perfect round trip in general (although it should be a good
round trip for the common simple case).


Pietro wrote:

> Hi,
>
> I imported in EMF an XSD file with this part inside:
>
> <xsd:complexType name="vector">
> <xsd:sequence>
> <xsd:element name="x" type="xsd:double"/>
> <xsd:element name="y" type="xsd:double"/>
> <xsd:element name="z" type="xsd:double"/>
> </xsd:sequence>
> </xsd:complexType>
>
> I worked on my model and then I exported again the data in XSD format
> (by "Generate Schema" function of genmodel).
>
> I obtained this (regarding the part above):
>
> <xsd:complexType name="Vector">
> <xsd:attribute name="x" type="xsd:string" use="required"/>
> <xsd:attribute name="y" type="xsd:string" use="required"/>
> <xsd:attribute name="z" type="xsd:string" use="required"/>
> </xsd:complexType>
>
> the simple types "xsd:double" of my original XSD have been translated
> in "xsd:string",
> and the original xsd:element name="x".... have been translated into
> xsd:attribute.
>
> To re-obtain the types "double" (and not "string"), I had to change in
> the ecore model the type of "x"... from Double into EDouble.
>
> I have to change the elementaty types into ETypes for all my entities,
> or is there an easier way to obtain in output an XSD more adherent to
> the input one ?
>
> Thanks a lot.
>
> Best Regards.
>
> Pietro
>
>



--------------090009040509050908010308
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Pietro,<br>
<br>
We are working on improved support that will take extended meta data
annotations into account and that will generate appropriate simple type
definitions:<br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=93194">93194</a><br>
</blockquote>
The focus is on being able to round trip Ecore -&gt; XSD -&gt;Ecore.
Previous Topic:Edit and persist features and references in a resource that has been lazily-loaded
Next Topic:XMLResource OPTION_RECORD_UNKNOWN_FEATURE does not handle "extra" known features
Goto Forum:
  


Current Time: Tue Sep 16 11:43:30 GMT 2014

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

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