Maps to a UML Class with the stereotype XSDredefine. This class has inner UML Classes as redefined elements. Every redefined element must be derived from other UML classes with stereotypes XSDsimpleType, XSDcomplexType, XSDgroup, or XSDattributeGroup. The name of this class shall match the “schemaLocation” value.
If two “redefine” with the same schema location appears, they shall be merged into the same class with the name “schemaLocation”.
The Redefine Class must be the inner class of the XSDschema Class.
- annotation - to the XSDredefine UML Class documentation
- schemaLocation – to the XSDredefine UML Class name.
<redefine
id = ID
schemaLocation = anyURI
{any attributes with non-schema namespace…}>
Content: (annotation | (simpleType | complexType | group | attributeGroup))*
</redefine>
v1.xsd:
<xs:complexType name="personName">
<xs:sequence>
<xs:element name="title" minOccurs="0"/>
<xs:element name="forename" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="addressee" type="personName"/>
v2.xsd:
<xs:redefine schemaLocation="v1.xsd">
<xs:complexType name="personName">
<xs:complexContent>
<xs:extension base="personName">
<xs:sequence>
<xs:element name="generation" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
<xs:element name="author" type="personName"/>
The schema corresponding to v2.xsd has everything specified by v1.xsd , with the personName type redefined, as well as everything it specifies. According to this schema, elements constrained by the personName type may end with a generation element. This includes not only the author element, but also the addressee element.
redefine UML model example.
<?xml version=’1.0’ encoding=’UTF-8’?
<xs:schema xmlns:nm="http://nomagic.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://nomagic.com">
<xs:redefine schemaLocation="http://nomagic.com">
<xs:simpleType name="string">
<xs:annotation>
<xs:documentation>my documentation</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string" />
</xs:simpleType>
</xs:redefine>
</xs:schema>