January 2003
Beginner to intermediate
1200 pages
23h 42m
English
So far, all the element declarations we've used in the ch05_07.xsd schema have used the type attribute to indicate the new element's type. But what if you want to use a type only once? Do you have to go to the trouble of declaring it and naming it, all to use it in only one element declaration?
It turns out that there is an easier way. You can use an anonymous type definition to avoid having to define a whole new type that you'll reference only once. Using an anonymous type definition simply means that you enclose a <xsd:simpleType> or <xsd:complexType> element inside an <xsd:element> element declaration. In this case, you don't assign an explicit value to the type attribute in the <xsd:element> element because ...