Re: Where have the element types gone?
----- Original Message ----- From: "Eric van der Vlist" <vdv@d...> To: <xml-dev@l...> Sent: Friday, December 07, 2001 8:55 AM Subject: Re: Where have the element types gone? > > Let's assume I am creating a vocabulary for book publishing and that I > create: > > 1) A "pub:isbn" datatype > 2) A "pub:isbn" element > > and that both of them are known by the application as identifying a ISBN > number. > > If I write in an instance document: > > <book> > <pub:isbn>....</pub:isbn> > ... > </book> > > Then, without needing to use any schema, an application (or a human > reader) knows without ambiguity that the content of <pub:isbn> is a ISBN > number as defined in the namespace prefixed as "pub". > > This is what I understand as the main objective of namespaces in XML and > the distinction is done on the element type + namespace. > > 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. > > The element type has become irrelevant (I could have used "foo" instead > of "isbn") and it has been replaced by the W3C XML Schema datatype. > > I hope this is clearer! > I've been thinking about this for most of the day and don't think I see much wrong with it. So on the one hand we've lost the ability to infer type information given the name of an element if the document uses schemas but on the other hand have gained a rich type system. In my book that's a rather fair exchange. This seems to only be an issue if applications try to ignore schema information and assume what the type information for an element is, and we all know that assumping is rarely a good idea. -- THINGS TO DO IF I BECOME AN EVIL OVERLORD #15 I will never employ any device with a digital countdown. If I find that such a device is absolutely unavoidable, I will set it to activate when the counter reaches 117 and the hero is just putting his plan into operation. _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
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