Elementary types importing from XSD into Ecore [message #396883] |
Fri, 18 November 2005 21:28 |
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> </DIV>
<DIV><FONT face=3DArial size=3D2>I imported in EMF an XSD file with =
this part=20
inside:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
<xsd:complexType name=3D"vector"><BR> =
=20
<xsd:sequence><BR> =
=20
<xsd:element name=3D"x"=20
type=3D"xsd:double"/><BR> =20
<xsd:element name=3D"y"=20
type=3D"xsd:double"/><BR> =20
<xsd:element name=3D"z"=20
type=3D"xsd:double"/><BR> =20
</xsd:sequence><BR> =20
</xsd:complexType></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>I obtained this (regarding the part=20
above):</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#333399 size=3D2><FONT=20
color=3D#000000><xsd:complexType =
name=3D"Vector"><BR><xsd:attribute=20
name=3D"x" type=3D"<FONT color=3D#ff0000>xsd:string</FONT>"=20
use=3D"required"/><BR><xsd:attribute name=3D"y" type=3D"<FONT=20
color=3D#ff0000>xsd:string</FONT>" =
use=3D"required"/><BR><xsd:attribute=20
name=3D"z" type=3D"<FONT color=3D#ff0000>xsd:string</FONT>"=20
use=3D"required"/><BR></xsd:complexType</FONT >></FONT></DIV>
<DIV><FONT face=3DArial color=3D#333399 size=3D2></FONT> </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> </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> </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> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks a lot.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Best Regards.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Pietro</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> </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 |
Ed Merks Messages: 33140 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 -> XSD ->Ecore.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03800 seconds