Re: Motivations for namespaces (sorry)
[Eric van der Vlist] > > Chiusano Joseph said: > > Eric, > > > I would argue that in this case, what's identifying your "document type" > is the xsi:schemaLocation more than the namespaces! > My point was rather that namespaces alone are not enough to guess what's > the document as a whole is about. In the task I described a post ago, it is exactly the namespace URI - OK, in practice it really is the prefix, so there! - that is so helpful. Realistic situation - let us say I encounter some unfamiliar element nested inside some structure. This could either be in an instance document or in a schema. I want to know more about it. Maybe I want to know how to write code to handle it. Maybe I want to evolve or correct the schema. Maybe I want to make sure some sample data makes sense. I see the element has an "erm:" prefix. Aha! I grab the ERM spec and look up the element, which turns out to be one of 250 enumerated choices. Next, I see an element in a location structure which is not too obvious - say 'administrativeArea'. What is that doing here? What do they want to see in it? Aha! the prefix is lrms:. I hyperlink over to the LRMS spec and find out that this means "State" for a US location. You see, most of the time I am not seeing the thing for the first time. I know where to go to find the information. I know what is going on. I just need to know which resource to go to. That is true for the schema developers, and that is true for xml developers who want to use the schema(s). And don't tell me that the prefix is no good, that it is only the URI that matters. That's theory, but once your schema is well under development, those prefixes are not going to change. It would be too confusing. The namespace URIs are more likely to change than the prefixes. And 98% of the time, other developers who create xml from a schema will use the same prefixes as the schema even though they theoretically do not need to. It is less cognitive work that way, and has more mnemonic value. That's important. That's why virtually all xslt stylesheets use xsl:. That's why virtually all XML Schemas use xs: or xsd:. That's why xhtml documents almost always use html: or xhtml:. It is why we name variables with mnemonic names rather that "dhf340cksdfnmg". It is mostly why we use readable URLs instead of GUIDs. This is what I meant when I said how helpful I (and others) found namespaces to be in this one task. This one task, though, is pretty representative of more and more development, as more schemas come into use. Cheers, Tom P
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