|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Industry Commentary XML Schema Best Practices
XML Schema Best Practices
By: Tom Gaven
Sep. 6, 2002 12:00 AM
In the June issue of XML-Journal I mentioned that we need a set of best practices that rein in the complexities of XML Schema. The set offered at www.xfront.com is a great start, but they cater to the XML Schema extremists, and I'd like to modify them, offering some alternative best practices for "the rest of us." You'll have to refer to www.xfront.org/BestPracticesHomepage.html to get a full description of the issues discussed below. Following are some ground rules I used to build my "modified" best practices list:
Best Practice #1
Well, this best practice wins a prize, in that it triggers
BOTH the O10P rule AND the SASUONS Rule!
Best Practice #2
Here's a case where XML Schema gives us too many choices, making it too confusing, without really giving any bang for the buck. My recommendation is to always declare elements (and attributes) locally, and always declare types globally. The exception is that root element must be declared globally.
Best Practice #3
This best practice needs to be removed from the list. Elements and types are disjoint schema components. You need to declare an element when you need to declare an element! That is, an element declaration is needed for every element found in the instance document. You need to declare a type when you need to declare a type. You need to declare a type when you are constructing content models.
Best Practice #4
This definitely triggers the SASUONS Rule, just by the
description above.
Best Practice #5
This best practice triggers the O10P Rule. Again, XML Schema
is just too complex. I'm against using substitution groups, abstract
elements, xsi:type, and complexType inheritance. I just think they
add too much confusion to schema development, and aren't worth the
pain.
Best Practice #6
I agree with the conclusion at xfront.org here: design by
composition is the preferred approach. However, I'd add a
recommendation to use XML Schema model groups as the preferred way to
design a content model via composition. ComplexType inheritance is
overused and broken. Use simpleType as needed.
Best Practice #7
I like the question, but don't like the answers proposed at
xfront.com for this one. There are two proposals: (1) use complexType
inheritance and xsi:type, and (2) use the Reader Feedback: Page 1 of 1
Latest Cloud Developer Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week
Breaking Cloud Computing News
|
|||||||||||||||||||||||||||||||||||||||||||||||||