Re: Where have the element types gone?
Eric van der Vlist wrote: > Now, if instead of this I define in a schema a "isbn" element in my > own namespace (or lack of namespace) having the datatype "pub:isbn": > > <xs:element name="isbn" type="pub:isbn"/> > > my instance document is: > > <book> > <isbn>....</isbn> > ... > </book> > > and determining that the content of <isbn> is a isbn number as defined > by the namespace prefixed as "pub" requires to process the schema. Not true. 1) Before we had namespaces, you made an assumption about the data type of the element based on its name, which might not have been universal. 2) After we had namespaces, and you chose to use them, you made an assumption about the data type of the element based on its name, which was "guaranteed" to be universal. 3) After we had schemas (and simple and complex types), you can still do (1) -- which is what you have done here -- or (2). You also have the additional ability to query the data type at run time if the schema is available. Each step gives you more options, but doesn't take away any of the previous options. BTW, in my opinion (this really isn't meant to be flame bait, but I suppose it will be anyway), defining element types without using namespaces is a bad idea for the long term. Your XML might be isolated now, but there is no guarantee that you or somebody unknown to you might want to reuse your XML at some point in the future, making universal names a very useful thing. -- Ron
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format