Chapter 18 Working with XML


Sequence

XML-Schema elements can be constrained to appear in the same order as they are declared, this is called a sequence.

In PowerDesigner, depending on the type of sequence you need to design, you can use one of the following methods:

<xsd:element name="item_sequence">
 <xsd:sequence>
  <xsd:element name="prodName" type="int"/>
  <xsd:element name="prodID" type="int"/>
  <xsd:element name="prodPrice" type="int"/>
 </xsd:sequence>
</xsd:element>

<xsd:element name="PurchaseOrder">
 <xsd:sequence>
  <xsd:element name="shipTo" type="int"/>
  <xsd:element name="billTo" type="int"/>
 </xsd:sequence>
 <xsd:element name="prodID" type="int"/>
</xsd:element>

By default, inner classes are generated before attributes in a class (as defined in the Class\Template\body entry in the object language definition file). However, you can modify generation order among class attributes using the attribute migration feature. To do so, you should create an association from the parent class to the <<sequence>> class, right-click the association and select Migrate → Migrate Navigable Roles. The migrated attribute can then be moved in the list of class attributes in order to have the desired generation order.


<xsd:element name="PurchaseOrder">
 <xsd:element name="prodID" type="int"/>
 <xsd:sequence>
  <xsd:element name="shipTo" type="int"/>
  <xsd:element name="billTo" type="int"/>
 </xsd:sequence>
</xsd:element>

 


Copyright (C) 2006. Sybase Inc. All rights reserved.