I have couple of questions 1. Is the 2nd XSD a correct definition ? 2. Whats the diffrence between the two definition. In first i have used "Type". In second it uses "reference" Can anyone clear my doubts ? Thanks in advance Hari
Hari, My understanding is that you use types when types are involved. Sometimes, on the other hand, you just want to break down your schema to more manageable pieces, without introducing new types. In just a case you can use the reference way. So, for example, the element toysco is very complex. The customer part is an element, which is referred to by element name in the toysco element. The same is done for the product and invoice elements.
William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Hari babu, The first one is a named complex type and the second one is an anonymous complex type. As the name suggests, a named complex type can be reused with the name. In the case of an anonymous complex type, you have to include the complexType definition in an element and refer to the element as given in the second snippet. In case of named complexType, you can directly refer to the complexType from an element as given in the first snippet. It is important to note the way the complexType is referred to from the elements in both the cases. For more details check out the Primer in w3c spec. Thank you, Rakesh.