s73v3r
s73v3r

Reputation: 1751

One central XML Schema for multiple XML files?

Currently, we have several configuration XML files in use, which all handle a separate portion of our configuration. One for test sequence, one for timeout, etc. These separate XML files are all defined/validated against a single XML Schema document, which holds all the definitions used in the separate XML files. Is this good practice? Or should each type of XML file have its own, separate XML Schema?

Upvotes: 0

Views: 1765

Answers (3)

David W
David W

Reputation: 945

Our current practice is to have a "common.xsd" for shared types and an xsd for each root element "root1.xsd" & "root2.xsd". One criticism of XSD is that it is not clear what the root element must be. The root xsd's import/include the common xsd. This eliminates any ambiguity.

Upvotes: 0

Michael Kay
Michael Kay

Reputation: 163352

There are arguments both ways - it's a judgement call. If there are common parts to the different files then a common schema certainly has benefits. If there aren't, and if the domains are so separate that there aren't likely to be, then I would go for separate schemas. But there's no easy answer. When you're defining a set of 400 application-to-application message formats for an integration backbone in a large investment bank, as one of my clients was, the disadvantages of both approaches become starkly clear.

Upvotes: 3

John Saunders
John Saunders

Reputation: 161783

This is a perfectly fine practice. This permits you to use some of the same types in multiple document types.

Upvotes: 1

Related Questions