Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » Preserve attribute order in XSD to Ecore import
Preserve attribute order in XSD to Ecore import [message #637803] Mon, 08 November 2010 22:55 Go to next message
Jason Barkanic is currently offline Jason BarkanicFriend
Messages: 16
Registered: November 2009
Junior Member
I'm creating an Ecore model from an XSD. Apparently the import process sorts a type's attributes alphabetically. Is there any way to turn this off, so that the resulting Ecore retains the order as written in the XSD?

I noticed that attributes defined in attribute groups do not get sorted, so I imagine I could create an attribute group for each of my types as a work around. (Or manually go through the Ecore and re-order things.) I have a lot of types though, so if there is an easier solution...


-Jason
Re: Preserve attribute order in XSD to Ecore import [message #638253 is a reply to message #637803] Wed, 10 November 2010 14:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26289
Registered: July 2009
Senior Member
Jason,

The underlying XSDEcoreBuilder is capable of preserving that order, but
it doesn't do so by default and there's no way via the UI to control
it. We'd need to add a checkbox to the UI for that. You could open a
bugzilla enhancement request.


jbarkanic wrote:
> I'm creating an Ecore model from an XSD. Apparently the import
> process sorts a type's attributes alphabetically. Is there any way to
> turn this off, so that the resulting Ecore retains the order as
> written in the XSD?
>
> I noticed that attributes defined in attribute groups do not get
> sorted, so I imagine I could create an attribute group for each of my
> types as a work around. (Or manually go through the Ecore and re-order
> things.) I have a lot of types though, so if there is an easier
> solution...
>
>
> -Jason
Re: Preserve attribute order in XSD to Ecore import [message #638517 is a reply to message #638253] Thu, 11 November 2010 14:56 Go to previous messageGo to next message
Jason Barkanic is currently offline Jason BarkanicFriend
Messages: 16
Registered: November 2009
Junior Member
Ok, thanks Ed.

When you say the XSDEcoreBuilder is capable, does that mean there's currently an exposed option in the class (which I could invoke from code manually), or does the class need to be modified as well? If so, what is that option?

https://bugs.eclipse.org/bugs/show_bug.cgi?id=330003
Re: Preserve attribute order in XSD to Ecore import [message #638609 is a reply to message #638517] Thu, 11 November 2010 18:28 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26289
Registered: July 2009
Senior Member
There's this method

protected boolean useSortedAttributes()
{
return true;
}

which would need to be overridden to return false to produce the result
you want.


jbarkanic wrote:
> Ok, thanks Ed.
> When you say the XSDEcoreBuilder is capable, does that mean there's
> currently an exposed option in the class (which I could invoke from
> code manually), or does the class need to be modified as well? If so,
> what is that option?
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=330003
Previous Topic:Ada 95 or 2005 metamodel resource (ecore)
Next Topic:serialize ecore references into container
Goto Forum:
  


Current Time: Mon Dec 22 10:40:14 GMT 2014

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

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