Download Altova XMLSpy 2011 Tutorial

Transcript
42
XMLSpy Tutorial
5.2
Specifying the Type of an Element
XML Documents
The child elements of Address are those defined for the global complex type AddressType (
the content model of which is defined in the XML Schema AddressLast.xsd shown in the Grid
View screenshot below).
We would, however, like to use a specific US or UK address type rather than the generic
address type. You will recall that, in the AddressLast.xsd schema, we created global
complex types for US-Address and UK-Address by extending the AddressType complex
type. The content model of US-Address is shown below.
In the XML document, in order to specify that the Address element must conform to one of the
extended Address types (US-Address or UK-Address) rather than the generic
AddressType, we must specify the required extended complex type as an attribute of the
Address element.
Do the following:
1. In the XML document, right-click the Name element, and select Insert | Attribute from
the context menu.
Altova XMLSpy 2011 Tutorial
© 2011 Altova GmbH