Author Topic: XML sequence positions  (Read 5730 times)

Scott 999

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
XML sequence positions
« on: April 22, 2010, 02:28:30 pm »
We are encountering a problem generating consistent XSDs.  The problem relates to the ordering of elements within sequences.  

For elements, contained as attributes, we can use “position” tagged value (currently we have to add these tagged values manually), for linked elements (via an association) it appears to be the order the links are created or the association guid that affects the position.

Questions:
1. Is there a better way of changing the position of the associated elements other than deleting the links and recreating them in the desired order (this is a pain because we have to re enter all of the detail on each link).
2. Is there a better way of setting the position tagged value than manually adding and maintaining it in the tagged values on the attribute elements.

Help would be appreciated.

Scott

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11312
  • Karma: +422/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: XML sequence positions
« Reply #1 on: April 22, 2010, 04:35:09 pm »
Scott,

If there's any logic in the ordering of elements you could write a simple addin to maintain the order for you. (for example based on the position on a diagram, or the position in the project browser, or...)

Geert

ChrisBD

  • EA User
  • **
  • Posts: 60
  • Karma: +0/-0
    • View Profile
Re: XML sequence positions
« Reply #2 on: April 22, 2010, 06:02:20 pm »
Of course the problem here is that the XML standard isn't concerned about ordering only about hierarchy.
I imagine that this is causing you problems with differencing with your version control system?

Scott 999

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: XML sequence positions
« Reply #3 on: April 23, 2010, 09:56:02 am »
Quote
Of course the problem here is that the XML standard isn't concerned about ordering only about hierarchy.
I imagine that this is causing you problems with differencing with your version control system?
The xsd:sequence element is all about ordering and EA supports the use of this, but apparently no easy means of altering the assigned ordering.

Yes, issues with VCS and other tools that use the resulting XSD to generate code or configure processes.

Scott 999

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: XML sequence positions
« Reply #4 on: April 23, 2010, 10:20:44 am »
Quote
Scott,

If there's any logic in the ordering of elements you could write a simple addin to maintain the order for you. (for example based on the position on a diagram, or the position in the project browser, or...)

Geert
Unfortunately the elements we are using are splayed across a number of packages which eliminates the possibility of using the order in the project browser.  With regards to ordering in the diagram, there is a conflict between the order of the simple types contained within a complex type and the links to other complex types.  We can add a position tag to each of the simple types, leaving gaps for the linked complex types, then the order of link creation is used to fill in any gaps in the specified positions.  This works, but it is going to be cumbersome to maintain.  I cannot see an alternative means of achieving this type of ordering when there are multiple packages involved.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11312
  • Karma: +422/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: XML sequence positions
« Reply #5 on: April 23, 2010, 01:50:19 pm »
And you can't use the same "position" tagged value on the associations?

Geert

VK

  • EA Administrator
  • EA User
  • *****
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: XML sequence positions
« Reply #6 on: April 23, 2010, 02:17:50 pm »
1. When you drag & drop an Element icon from the XML Schema tool-box into a XSDcomplexType class, the tag position will be automatically added on the created XSDelement.

2. To order the connectors, try setting the tag position on the Connector Source ( in the Tagged Values window )

Scott 999

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: XML sequence positions
« Reply #7 on: April 24, 2010, 11:02:09 pm »
Quote
1. When you drag & drop an Element icon from the XML Schema tool-box into a XSDcomplexType class, the tag position will be automatically added on the created XSDelement.

2. To order the connectors, try setting the tag position on the Connector Source ( in the Tagged Values window )
Setting the position tag on the Connector Source deals with the most painful issue, so thank you very much for this advice.

For some reason when we drop an element onto a XSDcomplexType  the position tag is not added - we have to add these maually.

JayHollingsworth

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: XML sequence positions
« Reply #8 on: June 29, 2021, 06:15:14 am »
I know this is an ancient post, but in case someone finds it in a search, like I just did (again), I wanted to add a couple of things which only seem obvious now that I'm in the midst of doing this on a bunch of classes.

Remember that you may have a UML class with several properties which will turn into XML elements, whether you have stereotyped them as XSDelement or not. Connectors come after the explicit properties in the sequence of XML elements. The element name is the target role name, unless you didn't provide a role name in which case it's the class name (not the association connector name).

The Position tag applies to all the XML elements - including the explicit properties - so depending on the order you want, don't forget to count those properties as well. If you want your connectors to continue to come at the end of the list (like I do) then don't start numbering them at 0 or 1, start with the number of properties.

Finally, UML properties stererotyped as XSDattribute don't count (since they won't appear in the sequence of elements anyway).

I hope this helps some future person fix the sequence order to their liking.