Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » XSD to Ecore order attributes
XSD to Ecore order attributes [message #74938] Mon, 04 August 2008 09:31 Go to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hello,
I use XSD Converter 2.4, EMF SDO 2.4 and the XSD 2.4 plugin. My problem is
when I create my Ecore and Genmodel with my XSD file, the attributes are
not sorted. I have seen that this porblem is corrected since XSD 2.2.1,
but I always have not sorted attributes.
How can I correct this?

Thx,
David.
Re: XSD to Ecore order attributes [message #75059 is a reply to message #74938] Mon, 04 August 2008 12:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060906070802050301040404
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

David,

EMF's implementation will always sort attributes because XSDEcoreBuilder has

protected boolean useSortedAttributes()
{
return true;
}

And https://bugs.eclipse.org/bugs/show_bug.cgi?id=236609 is open to
request EMF not sort the attributes. So I'm not sure how it's possible
for you to have unsorted attributes. Are you using Tuscany?


David wrote:
> Hello,
> I use XSD Converter 2.4, EMF SDO 2.4 and the XSD 2.4 plugin. My
> problem is when I create my Ecore and Genmodel with my XSD file, the
> attributes are not sorted. I have seen that this porblem is corrected
> since XSD 2.2.1, but I always have not sorted attributes.
> How can I correct this?
>
> Thx,
> David.
>

--------------060906070802050301040404
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
David,<br>
<br>
EMF's implementation will always sort attributes because
XSDEcoreBuilder has<br>
<blockquote><small>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XSD to Ecore order attributes [message #75078 is a reply to message #75059] Mon, 04 August 2008 14:48 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hi,
thanks for your answer.
I have seen the bug151123
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=151123) which speak about
this subject, but when I create my Ecore and my Genmodel, the attributes
are not sorted as in the XSD file. And I don't use Tuscany.
I use Eclipse 3.4 (Eclipse for RCP/Plug-in Developers package) and java 1.5

I don't understand what can be the problem.

Regards,
David.
Re: XSD to Ecore order attributes [message #75095 is a reply to message #75078] Mon, 04 August 2008 15:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040509090009080204030007
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

David,

In this note you talk about "not sorted as in the XSD file" which to me
is the exact opposite of "my attributes are not sorted" from your
original note. The fact is that the attributes are always sorted
alphabetically. Until 236609
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=236609> is supported,
likely in EMF/XSD 2.5.0, it will continue to be that way.


David wrote:
> Hi,
> thanks for your answer.
> I have seen the bug151123
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=151123) which speak
> about this subject, but when I create my Ecore and my Genmodel, the
> attributes are not sorted as in the XSD file. And I don't use Tuscany.
> I use Eclipse 3.4 (Eclipse for RCP/Plug-in Developers package) and
> java 1.5
>
> I don't understand what can be the problem.
>
> Regards,
> David.
>
>

--------------040509090009080204030007
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
David,<br>
<br>
In this note you talk about "not sorted as in the XSD file" which to me
is the exact opposite of "my attributes are not sorted" from your
original note.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XSD to Ecore order attributes [message #75112 is a reply to message #75095] Mon, 04 August 2008 15:35 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hi,
For me since XSD 2.2.1, when we generate Ecore and Genmodel, the
attributes are not alphabetical sorted, but they are sorted according to
the XSD file. Nevertheless I can't generate with XSD order, I always keep
alpabetical order. But I would like to get the XSD order.

Regards,
David.
Re: XSD to Ecore order attributes [message #75129 is a reply to message #75112] Mon, 04 August 2008 15:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030700050507040206040608
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

David,

Your first two sentences seem to contradict each other. The attributes
have always been alphabetically sorted and will always be alphabetically
sorted until we add an option to support the alternative that was added
for Tuscany which is not enabled by default. That's because the code as
below. The attribute uses of a complex type in the XSD model are
sorted. Only by reordering them to respect the order in the attribute
contents will they appear in the XSD source's order.

protected boolean useSortedAttributes()
{
return true;
}

protected List<XSDAttributeUse>
getAttributeUses(XSDComplexTypeDefinition xsdComplexTypeDefinition)
{
if (useSortedAttributes())
{
return xsdComplexTypeDefinition.getAttributeUses();
}
else
{
List<XSDAttributeUse> result = new
ArrayList<XSDAttributeUse>(xsdComplexTypeDefinition.getAttributeUses());
reorderAttributeUses(result,
xsdComplexTypeDefinition.getAttributeContents());
return result;
}
}

So basically you can get what you want.


David wrote:
> Hi,
> For me since XSD 2.2.1, when we generate Ecore and Genmodel, the
> attributes are not alphabetical sorted, but they are sorted according
> to the XSD file. Nevertheless I can't generate with XSD order, I
> always keep alpabetical order. But I would like to get the XSD order.
>
> Regards,
> David.
>

--------------030700050507040206040608
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
David,<br>
<br>
Your first two sentences seem to contradict each other.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XSD to Ecore order attributes [message #75180 is a reply to message #75129] Tue, 05 August 2008 08:10 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Ed,
Sorry if I have contradiction in what I say, and thanks for your help.
I understand what you say to get the order of XSD file to my attributes.
But I would like to know if it exists a version of the XSD plugin which
propose this order, or I have to get the plugin and do the modification in
the source. Because currently I use XSD 2.4 and I get alphabetical order,
and I have seen the bug 151123 in the xsd releases :
http://www.eclipse.org/modeling/mdt/news/relnotes.php?projec t=xsd&version=2.2.x&types=R


Regards,
David.
Re: XSD to Ecore order attributes [message #75216 is a reply to message #75180] Tue, 05 August 2008 13:06 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
David,

The other bugzilla only has the configurable support without making that
the default. If you modified the source and set what that method
returns to false, you'd get what you want.


David wrote:
> Ed,
> Sorry if I have contradiction in what I say, and thanks for your help.
> I understand what you say to get the order of XSD file to my
> attributes. But I would like to know if it exists a version of the XSD
> plugin which propose this order, or I have to get the plugin and do
> the modification in the source. Because currently I use XSD 2.4 and I
> get alphabetical order, and I have seen the bug 151123 in the xsd
> releases :
> http://www.eclipse.org/modeling/mdt/news/relnotes.php?projec t=xsd&version=2.2.x&types=R
>
>
>
> Regards,
> David.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XSD to Ecore order attributes [message #603165 is a reply to message #74938] Mon, 04 August 2008 12:03 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060906070802050301040404
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

David,

EMF's implementation will always sort attributes because XSDEcoreBuilder has

protected boolean useSortedAttributes()
{
return true;
}

And https://bugs.eclipse.org/bugs/show_bug.cgi?id=236609 is open to
request EMF not sort the attributes. So I'm not sure how it's possible
for you to have unsorted attributes. Are you using Tuscany?


David wrote:
> Hello,
> I use XSD Converter 2.4, EMF SDO 2.4 and the XSD 2.4 plugin. My
> problem is when I create my Ecore and Genmodel with my XSD file, the
> attributes are not sorted. I have seen that this porblem is corrected
> since XSD 2.2.1, but I always have not sorted attributes.
> How can I correct this?
>
> Thx,
> David.
>

--------------060906070802050301040404
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
David,<br>
<br>
EMF's implementation will always sort attributes because
XSDEcoreBuilder has<br>
<blockquote><small>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XSD to Ecore order attributes [message #603171 is a reply to message #75059] Mon, 04 August 2008 14:48 Go to previous message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hi,
thanks for your answer.
I have seen the bug151123
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=151123) which speak about
this subject, but when I create my Ecore and my Genmodel, the attributes
are not sorted as in the XSD file. And I don't use Tuscany.
I use Eclipse 3.4 (Eclipse for RCP/Plug-in Developers package) and java 1.5

I don't understand what can be the problem.

Regards,
David.
Re: XSD to Ecore order attributes [message #603174 is a reply to message #75078] Mon, 04 August 2008 15:29 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040509090009080204030007
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

David,

In this note you talk about "not sorted as in the XSD file" which to me
is the exact opposite of "my attributes are not sorted" from your
original note. The fact is that the attributes are always sorted
alphabetically. Until 236609
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=236609> is supported,
likely in EMF/XSD 2.5.0, it will continue to be that way.


David wrote:
> Hi,
> thanks for your answer.
> I have seen the bug151123
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=151123) which speak
> about this subject, but when I create my Ecore and my Genmodel, the
> attributes are not sorted as in the XSD file. And I don't use Tuscany.
> I use Eclipse 3.4 (Eclipse for RCP/Plug-in Developers package) and
> java 1.5
>
> I don't understand what can be the problem.
>
> Regards,
> David.
>
>

--------------040509090009080204030007
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
David,<br>
<br>
In this note you talk about "not sorted as in the XSD file" which to me
is the exact opposite of "my attributes are not sorted" from your
original note.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XSD to Ecore order attributes [message #603179 is a reply to message #75095] Mon, 04 August 2008 15:35 Go to previous message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hi,
For me since XSD 2.2.1, when we generate Ecore and Genmodel, the
attributes are not alphabetical sorted, but they are sorted according to
the XSD file. Nevertheless I can't generate with XSD order, I always keep
alpabetical order. But I would like to get the XSD order.

Regards,
David.
Re: XSD to Ecore order attributes [message #603183 is a reply to message #75112] Mon, 04 August 2008 15:55 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030700050507040206040608
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

David,

Your first two sentences seem to contradict each other. The attributes
have always been alphabetically sorted and will always be alphabetically
sorted until we add an option to support the alternative that was added
for Tuscany which is not enabled by default. That's because the code as
below. The attribute uses of a complex type in the XSD model are
sorted. Only by reordering them to respect the order in the attribute
contents will they appear in the XSD source's order.

protected boolean useSortedAttributes()
{
return true;
}

protected List<XSDAttributeUse>
getAttributeUses(XSDComplexTypeDefinition xsdComplexTypeDefinition)
{
if (useSortedAttributes())
{
return xsdComplexTypeDefinition.getAttributeUses();
}
else
{
List<XSDAttributeUse> result = new
ArrayList<XSDAttributeUse>(xsdComplexTypeDefinition.getAttributeUses());
reorderAttributeUses(result,
xsdComplexTypeDefinition.getAttributeContents());
return result;
}
}

So basically you can get what you want.


David wrote:
> Hi,
> For me since XSD 2.2.1, when we generate Ecore and Genmodel, the
> attributes are not alphabetical sorted, but they are sorted according
> to the XSD file. Nevertheless I can't generate with XSD order, I
> always keep alpabetical order. But I would like to get the XSD order.
>
> Regards,
> David.
>

--------------030700050507040206040608
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
David,<br>
<br>
Your first two sentences seem to contradict each other.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XSD to Ecore order attributes [message #603198 is a reply to message #75129] Tue, 05 August 2008 08:10 Go to previous message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Ed,
Sorry if I have contradiction in what I say, and thanks for your help.
I understand what you say to get the order of XSD file to my attributes.
But I would like to know if it exists a version of the XSD plugin which
propose this order, or I have to get the plugin and do the modification in
the source. Because currently I use XSD 2.4 and I get alphabetical order,
and I have seen the bug 151123 in the xsd releases :
http://www.eclipse.org/modeling/mdt/news/relnotes.php?projec t=xsd&version=2.2.x&types=R


Regards,
David.
Re: XSD to Ecore order attributes [message #603206 is a reply to message #75180] Tue, 05 August 2008 13:06 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
David,

The other bugzilla only has the configurable support without making that
the default. If you modified the source and set what that method
returns to false, you'd get what you want.


David wrote:
> Ed,
> Sorry if I have contradiction in what I say, and thanks for your help.
> I understand what you say to get the order of XSD file to my
> attributes. But I would like to know if it exists a version of the XSD
> plugin which propose this order, or I have to get the plugin and do
> the modification in the source. Because currently I use XSD 2.4 and I
> get alphabetical order, and I have seen the bug 151123 in the xsd
> releases :
> http://www.eclipse.org/modeling/mdt/news/relnotes.php?projec t=xsd&version=2.2.x&types=R
>
>
>
> Regards,
> David.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Dynamic Instance of XSD.ecore
Next Topic:Dynamic Instance of XSD.ecore
Goto Forum:
  


Current Time: Thu Apr 18 11:10:46 GMT 2024

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

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

Back to the top