Reputation: 973
There are essentially to ways to write an XSD:
1.) Use one single element (the root node) with an anonymous type. Describe the rest of the document only using either anonymous or explicit types
2.) Describe each tag as an element with anonymous type and use explicit types only to avoid redundancy (e.g. inheritance or when two elements use the same type)
At the beginning, I used (1). From time to time I moved to method (2) where right now all my XSDs are written that way.
Now I have the problem that each element can appear as the root node of a document! But I still want that only one specific element is defined as the root node and starting from this, the document structure is described.
Is there a way to avoid this without falling back to (1) ?
In any case, What is the preferable method to write XSDs?
Upvotes: 1
Views: 133
Reputation: 571
A similar question was asked (and answered) at https://stackoverflow.com/a/3672295/1145103 Essentially, you need to revert to (1)
Upvotes: 1