Redefining Types
In this section, you will learn how to redefine a type from one schema in another schema. You will also learn how to add a new element to a redefined type. This is also done in XMLSpy. For the purpose of this tutorial, we will use the schema book_order.xsd as an example.
To redefine the type PersonInfoType:
1.In SchemaAgent Client, right-click book_order.xsd and select Edit in XMLSpy (Ctrl+Y) from the context menu.
Notice that the schema contains a redefine statement, which was automatically added when you connected the two schemas in the Redefine section discussed previously.
2.Select the line that says "end of redefine" and click Insert .
3.Select ComplexType from the menu that pops up and enter "personInfoType" as the name for this type.
![sa_tutorial_redefine2](./images/sa_tutorial_redefine2.png)
4.Click the Display Diagram icon for personInfoType. The content model of personInfoType, as defined in event_registration.xsd, appears.
![spy_content-model-personInfoType](./images/spy_content-model-personinfotype.png)
5.Right-click the complexType, and select Add child | Sequence from the context menu.
![spy_add-child-sequence](./images/spy_add-child-sequence.png)
6.Right-click the new sequence icon and select Add Child | Element from the context menu.
![spy_add-child-sequence-element](./images/spy_add-child-sequence-element.png)
7.Enter "customerNumber" as the name for this element.
8.In the Details entry helper, select xs:string from the type drop-down list.
![sa_tutorial_redefine6](./images/sa_tutorial_redefine6.png)
9.Save the file.
You have now redefined personInfoType to be used as a type in the XML schema book_order.xsd.
![spy_content-model-personInfoType-redefined](./images/spy_content-model-personinfotype-redefined.png)