Default values in XMLSchema
I just want to mention, first, that all files referred to in my question were validated by the Schematron validator.
When, in chapter 4, we created a .dtd file and an .xml file which used that dtd, one of the attributes we created was "period" and we created it with a default value of "Cretaceous". Then, in dinosaurs5.xml and later iterations, we left out the "period" attribute on Gallimimus Bullatus. Nonetheless we had declared a default value for "period" and, sure enough, when I brought up our dinosaur xml file, in Firefox or in IE, the browser showed an attribute of "period='Cretaceous'" for Gallimimus, even though we had not entered one in the .xml file. This was correct behavior and I only mention it to compare to it what happened in Chapter 5.
In Chapter 5 we use XMLSchemas to achieve the same purpose that our dtd served in the previous chapter. Again, we create a "period" attribute and assign a default value of "Cretaceous". It is part of our DinoAttributes attributeGroup and it looks like this:
<attribute name="period" type="token" default="Cretaceous" />
Here's the difference, and here is my question: when I call up dinosaurs10.xml (or dinosaurs9.xml for that matter)in my browsers, there is NO period attribute listed for Gallimimus Bullatus. It is just not there. But it should be there, right?! So what is going on here? It would seem that the browsers don't understand XMLSchema as well as they do DTDs. Is this a browser bug, or what is it?
I really appreciate your input on this, as it is inexplicable to me. Thank you.
|