Chapter 18 Working with XML


Deriving types

XML-Schema allows you to derive new types by extending or restricting an existing type.

In PowerDesigner, you design the extension mechanism using a generalization between two classes. The contentDerivation extended attribute of the generalization allows you to set the type of derivation: extension or restriction.


<xsd:complexType name="A">
 <xsd:simpleContent>
  <xsd:extension base="B">
 
  </xsd:extension>
 </xsd:simpleContent>
</xsd:complexType>

To design type derivation from a basic type (defined in Settings\DataTypes\BasicDataTypes in the object language editor) you cannot use classes and generalizations, you have to use the simpleContentBase and simpleContentDerivation extended attributes. For example, class A derives from basic data type xsd:string. You define this derivation setting the following values for class A:


<xsd:complexType name="A">
 <xsd:simpleContent>
  <xsd:extension base="xsd:string">
 
  </xsd:extension>
 </xsd:simpleContent>
</xsd:complexType>

<xsd:complexType name="A">
 <xsd:complexContent>
  <xsd:restriction base="B">
 
  </xsd:restriction>
 </xsd:complexContent>
</xsd:complexType>

 


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