Pokemon; Ed, Edd, and Eddy; Masters of the Universe; Zoids.
These are the cartoons you get to watch, either because you woke up at 6am, or so happen to be watching at 9pm like I am.
Why am I watching TV right now? Because I was typing some schema code while sitting on my bed in my room, and my battery said it was getting low. My laptop's power cord is downstairs plugged in next to the couch in front of the TV, so here I sit and type.
Laptops are great because they're powerful enough to actually get some programming done these days. I don't have to be sitting at my desk any more.
Speaking of sitting at my desk, as my laptop sat on my desk last week, I wiped out the various source trees, and internal installations of Visual Studio, and loaded Visual Studio 2003 Professional. I debated a long time between this particular release, and putting the latest Whidbey release on my machine. I ended up with this stock version because it's what everyone in the public has. I want to do some coding samples, and I want those samples to be accessible to more people than Whidbey insiders.
In our group, we spend most of our time looking forward. VS 2003 represents code that we first released in 2002, which was originally designed in 1999/2000. But, what does it look like? I was part of the team which this stuff was designed. It seemed like it was all so terrific at the time.
The two most primary design centers were XmlReader and XmlNavigator. Other pieces of the puzzle include DOM, XSLTTransform and the like. XmlSchema came later in the cycle as the XML Schema standard was ratified. That's a whole other story that I'll have to relate some time.
What I'm looking for in particular is how to use the XmlSchema Object. I'm mainly concerned with how I can turn my newly inferred book schemas into working program code for a simple librarian application. There's plenty of fertile ground for this application. I'll let you know how it goes.
In the meanwhile, I was actually trying to use the Schema Object Model, and all I can say is... I'm sorry.
The conclusion I've come to is, using the C# editor to create schemas is not quite the right tool.
What I mean is this. When your schema looks something like this:
<xs:element name="myElement" >
<xs:group ref="testGroup" />
It's probably easier to write the following:
string xsd = "example.xsd"; FileStream fs; XmlSchema schema; fs = new FileStream(xsd, FileMode.Open); schema = XmlSchema.Read(fs, new ValidationEventHandler(ShowCompileError)); schema.Compile(new ValidationEventHandler(ShowCompileError));
In this case, Notepad has been used as the schema editor, and C# simply loads the result. To create this schema programatically is a lot more involved, and not really that fun. That method is good for tools that are generating schema on the fly. It's not really the interface that I would recommend for programmers who are consuming schemas.
So, maybe it's not that bad. You don't have to use the API to create the schemas, but what about reading it?
Wha? Is that Samurai Jack? Nope, X-Men. Sorry, gotta go!
I'll get back to you.