Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » The blues with anonymous simple types with enumeration facets in XML schemas
The blues with anonymous simple types with enumeration facets in XML schemas [message #388210] Wed, 29 September 2004 10:13 Go to next message
Jaap Reitsma is currently offline Jaap ReitsmaFriend
Messages: 69
Registered: July 2009
Member
Hi,

In the course of adding ecore:name annotations to my XSD schema, I stumbled
upon a difference in behaviour of the model generator. This is a simpleType
containing a union with an anonymous simpleType with enumerations.

I did not succeed in setting the ecore:name, it remained <type>Member0,
instead of the expected ecore:name.

I have attached an xsd file showing two test cases. When the enumeration is
not anonymous, all is fine. I noticed also that other anonymous simple types
inside unions that do not use enumeration behave as expected, see test case.

Could I have expected this behaviour?

Regards,

Jaap


  • Attachment: enumtest.xsd
    (Size: 1.71KB, Downloaded 107 times)
Re: The blues with anonymous simple types with enumeration facets in XML schemas [message #388216 is a reply to message #388210] Wed, 29 September 2004 12:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080909010009040207040607
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Jaap,

It's a bug. When an EEnum is created, the ecore:name attribute is
ignored. Please open a bugzilla. We need to make the following change:

Index: XSDEcoreBuilder.java
============================================================ =======
RCS file:
/home/technology/org.eclipse.xsd/plugins/org.eclipse.xsd/src /org/eclipse/xsd/ecore/XSDEcoreBuilder.java,v
retrieving revision 1.20
diff -u -r1.20 XSDEcoreBuilder.java
--- XSDEcoreBuilder.java 4 Aug 2004 19:26:22 -0000 1.20
+++ XSDEcoreBuilder.java 29 Sep 2004 12:05:19 -0000
@@ -651,7 +651,14 @@
{
EEnum eEnum = EcoreFactory.eINSTANCE.createEEnum();
setAnnotations(eEnum, xsdSimpleTypeDefinition);
-
eEnum.setName(validName(xsdSimpleTypeDefinition.getAliasName (), true));
+
+ String name = getEcoreAttribute(xsdSimpleTypeDefinition,
"name");
+ if (name == null)
+ {
+ name = validName(xsdSimpleTypeDefinition.getAliasName(),
true);
+ }
+
+ eEnum.setName(name);
extendedMetaData.setName(eEnum,
xsdSimpleTypeDefinition.getAliasName());

EPackage ePackage = getEPackage(xsdSimpleTypeDefinition);




Jaap Reitsma wrote:

>Hi,
>
>In the course of adding ecore:name annotations to my XSD schema, I stumbled
>upon a difference in behaviour of the model generator. This is a simpleType
>containing a union with an anonymous simpleType with enumerations.
>
>I did not succeed in setting the ecore:name, it remained <type>Member0,
>instead of the expected ecore:name.
>
>I have attached an xsd file showing two test cases. When the enumeration is
>not anonymous, all is fine. I noticed also that other anonymous simple types
>inside unions that do not use enumeration behave as expected, see test case.
>
>Could I have expected this behaviour?
>
>Regards,
>
>Jaap
>
>
>
>


--------------080909010009040207040607
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Jaap,<br>
<br>
It's a bug.&nbsp; When an EEnum is created, the ecore:name attribute is
ignored.&nbsp; Please open a bugzilla.&nbsp; We need to make the following change:<br>
<blockquote>Index: XSDEcoreBuilder.java<br>
============================================================ ======= <br>
RCS file:
/home/technology/org.eclipse.xsd/plugins/org.eclipse.xsd/src /org/eclipse/xsd/ecore/XSDEcoreBuilder.java,v <br>
retrieving revision 1.20<br>
diff -u -r1.20 XSDEcoreBuilder.java<br>
--- XSDEcoreBuilder.java&nbsp;&nbsp;&nbsp; 4 Aug 2004 19:26:22 -0000&nbsp;&nbsp;&nbsp; 1.20<br>
+++ XSDEcoreBuilder.java&nbsp;&nbsp;&nbsp; 29 Sep 2004 12:05:19 -0000<br>
@@ -651,7 +651,14 @@<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; EEnum eEnum = EcoreFactory.eINSTANCE.createEEnum();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; setAnnotations(eEnum, xsdSimpleTypeDefinition);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;
eEnum.setName(validName(xsdSimpleTypeDefinition.getAliasName (), true));<br>
+<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; String name = getEcoreAttribute(xsdSimpleTypeDefinition,
"name");<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; if (name == null)<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; {<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp; name = validName(xsdSimpleTypeDefinition.getAliasName(),
true);<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; }<br>
+<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; eEnum.setName(name);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; extendedMetaData.setName(eEnum,
xsdSimpleTypeDefinition.getAliasName());<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; EPackage ePackage = getEPackage(xsdSimpleTypeDefinition);<br>
<br>
</blockquote>
<br>
<br>
<br>
Jaap Reitsma wrote:<br>
<blockquote cite="midcje1jo$53c$1@eclipse.org" type="cite">
<pre wrap="">Hi,

In the course of adding ecore:name annotations to my XSD schema, I stumbled
upon a difference in behaviour of the model generator. This is a simpleType
containing a union with an anonymous simpleType with enumerations.

I did not succeed in setting the ecore:name, it remained &lt;type&gt;Member0,
instead of the expected ecore:name.

I have attached an xsd file showing two test cases. When the enumeration is
not anonymous, all is fine. I noticed also that other anonymous simple types
inside unions that do not use enumeration behave as expected, see test case.

Could I have expected this behaviour?

Regards,

Jaap


</pre>
</blockquote>
<br>
</body>
</html>

--------------080909010009040207040607--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: The blues with anonymous simple types with enumeration facets in XML schemas [message #388217 is a reply to message #388216] Wed, 29 September 2004 12:33 Go to previous messageGo to next message
Jaap Reitsma is currently offline Jaap ReitsmaFriend
Messages: 69
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_0079_01C4A631.4E014190
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

I was afraid so. What do you mean with open Bugzilla, should I create a =
bug report?

Does this also cause the same side-effect when a attribute has the name =
'type'?

Regards,

Jaap
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:cje898$j05$1@eclipse.org...
Jaap,

It's a bug. When an EEnum is created, the ecore:name attribute is =
ignored. Please open a bugzilla. We need to make the following change:

Index: XSDEcoreBuilder.java
=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: =
/home/technology/org.eclipse.xsd/plugins/org.eclipse.xsd/src /org/eclipse/=
xsd/ecore/XSDEcoreBuilder.java,v
retrieving revision 1.20
diff -u -r1.20 XSDEcoreBuilder.java
--- XSDEcoreBuilder.java 4 Aug 2004 19:26:22 -0000 1.20
+++ XSDEcoreBuilder.java 29 Sep 2004 12:05:19 -0000
@@ -651,7 +651,14 @@
{
EEnum eEnum =3D EcoreFactory.eINSTANCE.createEEnum();
setAnnotations(eEnum, xsdSimpleTypeDefinition);
- =
eEnum.setName(validName(xsdSimpleTypeDefinition.getAliasName (), true));
+
+ String name =3D getEcoreAttribute(xsdSimpleTypeDefinition, =
"name");
+ if (name =3D=3D null)
+ {
+ name =3D =
validName(xsdSimpleTypeDefinition.getAliasName(), true);
+ }
+
+ eEnum.setName(name);
extendedMetaData.setName(eEnum, =
xsdSimpleTypeDefinition.getAliasName());
=20
EPackage ePackage =3D getEPackage(xsdSimpleTypeDefinition);





Jaap Reitsma wrote:

Hi,

In the course of adding ecore:name annotations to my XSD schema, I =
stumbled
upon a difference in behaviour of the model generator. This is a =
simpleType
containing a union with an anonymous simpleType with enumerations.

I did not succeed in setting the ecore:name, it remained <type>Member0,
instead of the expected ecore:name.

I have attached an xsd file showing two test cases. When the enumeration =
is
not anonymous, all is fine. I noticed also that other anonymous simple =
types
inside unions that do not use enumeration behave as expected, see test =
case.

Could I have expected this behaviour?

Regards,

Jaap


=20

------=_NextPart_000_0079_01C4A631.4E014190
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2800.1458" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3D"Courier New" size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>I was afraid so. What do you =
mean with open=20
Bugzilla, should I create a bug report?</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Does this also cause the same =
side-effect=20
when a attribute has the name 'type'?</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Jaap</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:cje898$j05$1@eclipse.org">news:cje898$j05$1@eclipse.org</A>.=
...</DIV>Jaap,<BR><BR>It's=20
a bug.&nbsp; When an EEnum is created, the ecore:name attribute is=20
ignored.&nbsp; Please open a bugzilla.&nbsp; We need to make the =
following=20
change:<BR>
<BLOCKQUOTE>Index:=20
=
XSDEcoreBuilder.java<BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
<BR>RCS=20
file:=20
=
/home/technology/org.eclipse.xsd/plugins/org.eclipse.xsd/src /org/eclipse/=
xsd/ecore/XSDEcoreBuilder.java,v<BR>retrieving=20
revision 1.20<BR>diff -u -r1.20 XSDEcoreBuilder.java<BR>---=20
XSDEcoreBuilder.java&nbsp;&nbsp;&nbsp; 4 Aug 2004 19:26:22=20
-0000&nbsp;&nbsp;&nbsp; 1.20<BR>+++ =
XSDEcoreBuilder.java&nbsp;&nbsp;&nbsp;=20
29 Sep 2004 12:05:19 -0000<BR>@@ -651,7 +651,14=20
@@<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =20
{<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; EEnum eEnum =
=3D=20
=
EcoreFactory.eINSTANCE.createEEnum();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
setAnnotations(eEnum,=20
=
xsdSimpleTypeDefinition);<BR> -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; =

eEnum.setName(validName(xsdSimpleTypeDefinition.getAliasName (),=20
true));<BR>+<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; String =
name =3D=20
getEcoreAttribute(xsdSimpleTypeDefinition,=20
"name");<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; if (name =
=3D=3D=20
null)<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;=20
{<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp; name =
=3D=20
validName(xsdSimpleTypeDefinition.getAliasName(),=20
true);<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;=20
}<BR>+<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;=20
=
eEnum.setName(name);<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; =

extendedMetaData.setName(eEnum,=20
=
xsdSimpleTypeDefinition.getAliasName());<BR>&nbsp;<BR >&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
EPackage ePackage =3D=20
=
getEPackage(xsdSimpleTypeDefinition);<BR><BR></BLOCKQUOTE ><BR><BR><BR>Jaa=
p=20
Reitsma wrote:<BR>
<BLOCKQUOTE cite=3Dmidcje1jo$53c$1@eclipse.org type=3D"cite"><PRE =
wrap=3D"">Hi,

In the course of adding ecore:name annotations to my XSD schema, I =
stumbled
upon a difference in behaviour of the model generator. This is a =
simpleType
containing a union with an anonymous simpleType with enumerations.

I did not succeed in setting the ecore:name, it remained =
&lt;type&gt;Member0,
instead of the expected ecore:name.

I have attached an xsd file showing two test cases. When the enumeration =
is
not anonymous, all is fine. I noticed also that other anonymous simple =
types
inside unions that do not use enumeration behave as expected, see test =
case.

Could I have expected this behaviour?

Regards,

Jaap


</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0079_01C4A631.4E014190--
Re: The blues with anonymous simple types with enumeration facets in XML schemas [message #388218 is a reply to message #388217] Wed, 29 September 2004 13:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080803020707010402040603
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Jaap,

Yes, I mean create a bug report using bugzilla.

Now that you draw my attention to it, I noticed that the renaming isn't
taking affect for features of the DocumentRoot either so this additional
change is needed:

Index: XSDEcoreBuilder.java
============================================================ =======
RCS file:
/home/technology/org.eclipse.xsd/plugins/org.eclipse.xsd/src /org/eclipse/xsd/ecore/XSDEcoreBuilder.java,v
retrieving revision 1.20
diff -u -r1.20 XSDEcoreBuilder.java
--- XSDEcoreBuilder.java 4 Aug 2004 19:26:22 -0000 1.20
+++ XSDEcoreBuilder.java 29 Sep 2004 13:00:33 -0000
@@ -651,7 +651,14 @@
{
EEnum eEnum = EcoreFactory.eINSTANCE.createEEnum();
setAnnotations(eEnum, xsdSimpleTypeDefinition);
-
eEnum.setName(validName(xsdSimpleTypeDefinition.getAliasName (), true));
+
+ String name = getEcoreAttribute(xsdSimpleTypeDefinition,
"name");
+ if (name == null)
+ {
+ name = validName(xsdSimpleTypeDefinition.getAliasName(),
true);
+ }
+
+ eEnum.setName(name);
extendedMetaData.setName(eEnum,
xsdSimpleTypeDefinition.getAliasName());

EPackage ePackage = getEPackage(xsdSimpleTypeDefinition);
@@ -1820,10 +1827,15 @@
extendedMetaData.setName(xsiSchemaLocationMapFeature,
"xsi:schemaLocation");
}

+ String name = getEcoreAttribute(xsdFeature, "name");
+ if (name == null)
+ {
+ name= validName(xsdFeature.getName(), false);
+ }
eStructuralFeature =
createFeature
(documentEClass,
- validName(xsdFeature.getName(), false),
+ name,
getEClassifier(xsdFeature.getType()),
xsdFeature);

Maybe this is what you noticed too? Or are you refering to something else?

Jaap Reitsma wrote:

> Hi Ed,
>
> I was afraid so. What do you mean with open Bugzilla, should I create
> a bug report?
>
> Does this also cause the same side-effect when a attribute has the
> name 'type'?
>
> Regards,
>
> Jaap
>
> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> wrote in
> message news:cje898$j05$1@eclipse.org...
> Jaap,
>
> It's a bug. When an EEnum is created, the ecore:name attribute is
> ignored. Please open a bugzilla. We need to make the following
> change:
>
> Index: XSDEcoreBuilder.java
> ============================================================ =======
> RCS file:
> /home/technology/org.eclipse.xsd/plugins/org.eclipse.xsd/src /org/eclipse/xsd/ecore/XSDEcoreBuilder.java,v
> retrieving revision 1.20
> diff -u -r1.20 XSDEcoreBuilder.java
> --- XSDEcoreBuilder.java 4 Aug 2004 19:26:22 -0000 1.20
> +++ XSDEcoreBuilder.java 29 Sep 2004 12:05:19 -0000
> @@ -651,7 +651,14 @@
> {
> EEnum eEnum = EcoreFactory.eINSTANCE.createEEnum();
> setAnnotations(eEnum, xsdSimpleTypeDefinition);
> -
> eEnum.setName(validName(xsdSimpleTypeDefinition.getAliasName (),
> true));
> +
> + String name =
> getEcoreAttribute(xsdSimpleTypeDefinition, "name");
> + if (name == null)
> + {
> + name =
> validName(xsdSimpleTypeDefinition.getAliasName(), true);
> + }
> +
> + eEnum.setName(name);
> extendedMetaData.setName(eEnum,
> xsdSimpleTypeDefinition.getAliasName());
>
> EPackage ePackage = getEPackage(xsdSimpleTypeDefinition);
>
>
>
>
> Jaap Reitsma wrote:
>
>>Hi,
>>
>>In the course of adding ecore:name annotations to my XSD schema, I stumbled
>>upon a difference in behaviour of the model generator. This is a simpleType
>>containing a union with an anonymous simpleType with enumerations.
>>
>>I did not succeed in setting the ecore:name, it remained <type>Member0,
>>instead of the expected ecore:name.
>>
>>I have attached an xsd file showing two test cases. When the enumeration is
>>not anonymous, all is fine. I noticed also that other anonymous simple types
>>inside unions that do not use enumeration behave as expected, see test case.
>>
>>Could I have expected this behaviour?
>>
>>Regards,
>>
>>Jaap
>>
>>
>>
>>
>


--------------080803020707010402040603
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Jaap,<br>
<br>
Yes, I mean create a bug report using bugzilla.&nbsp;&nbsp; <br>
<br>
Now that you draw my attention to it, I noticed that the renaming isn't
taking affect for features of the DocumentRoot either so this
additional change is needed:<br>
<blockquote>Index: XSDEcoreBuilder.java<br>
============================================================ ======= <br>
RCS file:
/home/technology/org.eclipse.xsd/plugins/org.eclipse.xsd/src /org/eclipse/xsd/ecore/XSDEcoreBuilder.java,v <br>
retrieving revision 1.20<br>
diff -u -r1.20 XSDEcoreBuilder.java<br>
--- XSDEcoreBuilder.java&nbsp;&nbsp;&nbsp; 4 Aug 2004 19:26:22 -0000&nbsp;&nbsp;&nbsp; 1.20<br>
+++ XSDEcoreBuilder.java&nbsp;&nbsp;&nbsp; 29 Sep 2004 13:00:33 -0000<br>
@@ -651,7 +651,14 @@<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; EEnum eEnum = EcoreFactory.eINSTANCE.createEEnum();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; setAnnotations(eEnum, xsdSimpleTypeDefinition);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;
eEnum.setName(validName(xsdSimpleTypeDefinition.getAliasName (), true));<br>
+<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; String name = getEcoreAttribute(xsdSimpleTypeDefinition,
"name");<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; if (name == null)<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; {<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp; name = validName(xsdSimpleTypeDefinition.getAliasName(),
true);<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; }<br>
+<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; eEnum.setName(name);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; extendedMetaData.setName(eEnum,
xsdSimpleTypeDefinition.getAliasName());<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; EPackage ePackage = getEPackage(xsdSimpleTypeDefinition);<br>
@@ -1820,10 +1827,15 @@<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; extendedMetaData.setName(xsiSchemaLocationMapFeature,
"xsi:schemaLocation");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String name = getEcoreAttribute(xsdFeature, "name");<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (name == null)<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; name= validName(xsdFeature.getName(), false);<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eStructuralFeature =<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; createFeature<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; (documentEClass,<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp; validName(xsdFeature.getName(), false),<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp; name,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getEClassifier(xsdFeature.getType()),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xsdFeature);<br>
</blockquote>
&nbsp;Maybe this is what you noticed too?&nbsp; Or are you refering to something
else?<br>
<br>
Jaap Reitsma wrote:<br>
<blockquote cite="midcje9q6$m85$1@eclipse.org" type="cite">
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.2800.1458" name="GENERATOR">
<style></style>
<div><font face="Courier New" size="2">Hi Ed,</font></div>
<div>&nbsp;</div>
<div><font face="Courier New" size="2">I was afraid so. What do you
mean with open Bugzilla, should I create a bug report?</font></div>
<div>&nbsp;</div>
<div><font face="Courier New" size="2">Does this also cause the same
side-effect when a attribute has the name 'type'?</font></div>
<div>&nbsp;</div>
<div><font face="Courier New" size="2">Regards,</font></div>
<div>&nbsp;</div>
<div><font face="Courier New" size="2">Jaap</font></div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt;
wrote in message <a href="news:cje898$j05$1@eclipse.org">news:cje898$j05$1@eclipse.org</a>...</div>
Jaap,<br>
<br>
It's a bug.&nbsp; When an EEnum is created, the ecore:name attribute is
ignored.&nbsp; Please open a bugzilla.&nbsp; We need to make the following change:<br>
<blockquote>Index: XSDEcoreBuilder.java<br>
============================================================ ======= <br>
RCS file:
/home/technology/org.eclipse.xsd/plugins/org.eclipse.xsd/src /org/eclipse/xsd/ecore/XSDEcoreBuilder.java,v <br>
retrieving revision 1.20<br>
diff -u -r1.20 XSDEcoreBuilder.java<br>
--- XSDEcoreBuilder.java&nbsp;&nbsp;&nbsp; 4 Aug 2004 19:26:22 -0000&nbsp;&nbsp;&nbsp; 1.20<br>
+++ XSDEcoreBuilder.java&nbsp;&nbsp;&nbsp; 29 Sep 2004 12:05:19 -0000<br>
@@ -651,7 +651,14 @@<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; EEnum eEnum = EcoreFactory.eINSTANCE.createEEnum();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; setAnnotations(eEnum, xsdSimpleTypeDefinition);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;
eEnum.setName(validName(xsdSimpleTypeDefinition.getAliasName (), true));<br>
+<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; String name = getEcoreAttribute(xsdSimpleTypeDefinition,
"name");<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; if (name == null)<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; {<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp; name = validName(xsdSimpleTypeDefinition.getAliasName(),
true);<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; }<br>
+<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; eEnum.setName(name);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; extendedMetaData.setName(eEnum,
xsdSimpleTypeDefinition.getAliasName());<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; EPackage ePackage = getEPackage(xsdSimpleTypeDefinition);<br>
<br>
</blockquote>
<br>
<br>
<br>
Jaap Reitsma wrote:<br>
<blockquote cite="midcje1jo$53c$1@eclipse.org" type="cite">
<pre wrap="">Hi,

In the course of adding ecore:name annotations to my XSD schema, I stumbled
upon a difference in behaviour of the model generator. This is a simpleType
containing a union with an anonymous simpleType with enumerations.

I did not succeed in setting the ecore:name, it remained &lt;type&gt;Member0,
instead of the expected ecore:name.

I have attached an xsd file showing two test cases. When the enumeration is
not anonymous, all is fine. I noticed also that other anonymous simple types
inside unions that do not use enumeration behave as expected, see test case.

Could I have expected this behaviour?

Regards,

Jaap


</pre>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------080803020707010402040603--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: The blues with anonymous simple types with enumeration facets in XML schemas [message #388219 is a reply to message #388218] Wed, 29 September 2004 13:34 Go to previous message
Jaap Reitsma is currently offline Jaap ReitsmaFriend
Messages: 69
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_00A0_01C4A639.C2E23D90
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

Bugzilla #75278.

My question on the name =3D 'type' thing was invalid. I hadn't noticed =
the document root features yet.

Thanks,

Jaap
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:cjebgt$q2a$1@eclipse.org...
Jaap,

Yes, I mean create a bug report using bugzilla. =20

Now that you draw my attention to it, I noticed that the renaming =
isn't taking affect for features of the DocumentRoot either so this =
additional change is needed:

Index: XSDEcoreBuilder.java
=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: =
/home/technology/org.eclipse.xsd/plugins/org.eclipse.xsd/src /org/eclipse/=
xsd/ecore/XSDEcoreBuilder.java,v
retrieving revision 1.20
diff -u -r1.20 XSDEcoreBuilder.java
--- XSDEcoreBuilder.java 4 Aug 2004 19:26:22 -0000 1.20
+++ XSDEcoreBuilder.java 29 Sep 2004 13:00:33 -0000
@@ -651,7 +651,14 @@
{
EEnum eEnum =3D EcoreFactory.eINSTANCE.createEEnum();
setAnnotations(eEnum, xsdSimpleTypeDefinition);
- =
eEnum.setName(validName(xsdSimpleTypeDefinition.getAliasName (), true));
+
+ String name =3D getEcoreAttribute(xsdSimpleTypeDefinition, =
"name");
+ if (name =3D=3D null)
+ {
+ name =3D =
validName(xsdSimpleTypeDefinition.getAliasName(), true);
+ }
+
+ eEnum.setName(name);
extendedMetaData.setName(eEnum, =
xsdSimpleTypeDefinition.getAliasName());
=20
EPackage ePackage =3D getEPackage(xsdSimpleTypeDefinition);
@@ -1820,10 +1827,15 @@
extendedMetaData.setName(xsiSchemaLocationMapFeature, =
"xsi:schemaLocation");
}
=20
+ String name =3D getEcoreAttribute(xsdFeature, "name");
+ if (name =3D=3D null)
+ {
+ name=3D validName(xsdFeature.getName(), false);
+ }
eStructuralFeature =3D
createFeature
(documentEClass,
- validName(xsdFeature.getName(), false),
+ name,
getEClassifier(xsdFeature.getType()),
xsdFeature);

Maybe this is what you noticed too? Or are you refering to something =
else?

zip
------=_NextPart_000_00A0_01C4A639.C2E23D90
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2800.1458" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3D"Courier New" size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Bugzilla #75278.</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>My question on the name =3D =
'type' thing was=20
invalid. I hadn't noticed the document root features yet.</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Jaap</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:cjebgt$q2a$1@eclipse.org">news:cjebgt$q2a$1@eclipse.org</A>.=
...</DIV>Jaap,<BR><BR>Yes,=20
I mean create a bug report using bugzilla.&nbsp;&nbsp; <BR><BR>Now =
that you=20
draw my attention to it, I noticed that the renaming isn't taking =
affect for=20
features of the DocumentRoot either so this additional change is =
needed:<BR>
<BLOCKQUOTE>Index:=20
=
XSDEcoreBuilder.java<BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
<BR>RCS=20
file:=20
=
/home/technology/org.eclipse.xsd/plugins/org.eclipse.xsd/src /org/eclipse/=
xsd/ecore/XSDEcoreBuilder.java,v<BR>retrieving=20
revision 1.20<BR>diff -u -r1.20 XSDEcoreBuilder.java<BR>---=20
XSDEcoreBuilder.java&nbsp;&nbsp;&nbsp; 4 Aug 2004 19:26:22=20
-0000&nbsp;&nbsp;&nbsp; 1.20<BR>+++ =
XSDEcoreBuilder.java&nbsp;&nbsp;&nbsp;=20
29 Sep 2004 13:00:33 -0000<BR>@@ -651,7 +651,14=20
@@<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =20
{<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; EEnum eEnum =
=3D=20
=
EcoreFactory.eINSTANCE.createEEnum();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
setAnnotations(eEnum,=20
=
xsdSimpleTypeDefinition);<BR> -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; =

eEnum.setName(validName(xsdSimpleTypeDefinition.getAliasName (),=20
true));<BR>+<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; String =
name =3D=20
getEcoreAttribute(xsdSimpleTypeDefinition,=20
"name");<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; if (name =
=3D=3D=20
null)<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;=20
{<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp; name =
=3D=20
validName(xsdSimpleTypeDefinition.getAliasName(),=20
true);<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;=20
}<BR>+<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;=20
=
eEnum.setName(name);<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; =

extendedMetaData.setName(eEnum,=20
=
xsdSimpleTypeDefinition.getAliasName());<BR>&nbsp;<BR >&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
EPackage ePackage =3D getEPackage(xsdSimpleTypeDefinition);<BR>@@ =
-1820,10=20
+1827,15 @@<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=20
extendedMetaData.setName(xsiSchemaLocationMapFeature,=20
"xsi:schemaLocation");<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =20
}<BR>&nbsp;<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String name =3D=20
getEcoreAttribute(xsdFeature, =
"name");<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if=20
(name =3D=3D null)<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
{<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; name=3D=20
validName(xsdFeature.getName(), =
false);<BR>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eStructuralFeature=20
=3D<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=20
=
createFeature<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&n=
bsp;=20
=
(documentEClass,<BR> -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbs=
p;&nbsp;=20
validName(xsdFeature.getName(),=20
=
false),<BR> +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp; =

=
name,<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
=
getEClassifier(xsdFeature.getType()),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
xsdFeature);<BR></BLOCKQUOTE>
<DIV>&nbsp;Maybe this is what you noticed too?&nbsp; Or are you =
refering to=20
something else?<BR><FONT face=3D"Courier New" size=3D2></FONT></DIV>
<DIV><FONT face=3D"Courier New" =
size=3D2>zip</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_00A0_01C4A639.C2E23D90--
Previous Topic:Best way to hook package registry (getEPackage)?
Next Topic:AnyType Serialization
Goto Forum:
  


Current Time: Thu Sep 26 16:01:52 GMT 2024

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

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

Back to the top