Redefining Types

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  SchemaAgent Tutorial > Using XMLSpy as a SchemaAgent Client >

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.

spy_schema-overview-book

Notice that the schema contains a redefine statement, which was automatically added when you connected the two schemas in the Redefine section discussed previously.

 

 

To redefine the type PersonInfoType:

1.Open book_order.xsd in XMLSpy.
2.Select the line that says "end of redefine" and click the Insert ic_schem_ins icon.
3.Select ComplexType from the menu that pops up and enter "personInfoType" as the name for this type.

spy_schema-overview-book-extended

4.Click the Display Diagram ic_component icon for personInfoType. The content model of personInfoType, as defined in event_registration.xsd, appears.

spy_content-model-personInfoType

5.Right-click the personInfoType2 complexType, and select Add child | Sequence from the context menu.

spy_add-child-sequence

6.Right-click the new sequence icon and select Add Child | Element from the context menu.

spy_add-child-sequence-element

7.Enter "customerNumber" as the name for this element.
8.In the Details entry helper, select xs:string from the type drop-down list.

spy_details-customerNumber

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


© 2019 Altova GmbH