Tim's going to talk about his experience XML-ifying MSDN. Tim is a really high energyguy -- he's been flitting all around the conference talking to numerous people aboutall sorts of technical esoterica. And he seems to know just about everything.
It's impossible to do 1-1 type mappings between XSD and the CLR, and make those typemappings robust and round-trippable.
"I don't look at XSD as a type system. I look at them as templates for what your documentis meant to look like"
Schema validation is just one way of many that allows developers to assert that anincoming XML blob looks a certain way.
A lot of XML documents carry schemas around and present them to their clients, effectivelysaying "Here's what I conform to". The thing is, the client doesn't really care somuch what the message thinks it complies with& the client has its own idea ofwhat that message should look like.
MSDN tried to implement a schema type hierarchy that used derivation-by-restriction.Trying to keep the three goals of restriction, extension, and composition is virutallyimpossible.
How do we use schema in such a way that lets us assert what we want, when we careabout it?
All the MSDN schemas use anonymous types. Low-level schemas basically define "if Isee an element named XXX from YYY namespace, this is what it would have to look like."
Midlevel schemas define minimal sets of information plus wildcards. Highlevel schemasassert more rules. All of these schemas are defined in the SAME TARGET NAMESPACE!And they all overlap, all elements are defined in all the schemas -- they just haveclient (and usage) specific definitions.
In addition to only using anonymous types in their schemas, MSDN only uses globalelement declarations. This lets any element be the root of a schema validation tree.This does, however, makes it really hard to generate C# code from these schemas.
Tim Ewald talks about schema
Friday, July 11 2003 - blog
