re: Namespace Basic Principles
Sean B. Palmer writes: > <div xmlns="http://www.w3.org/1999/xhtml" /> > > It has often been siad that the most useful characteristic of having a > unique name for XML is simply that it is therfore unique. > The above example is an XHTML div element. But how do we know it is XHTML? > It has the unique XHTML namespace... but how does that tell us it is > "XHTML"? How could anything tell software what anything means without human intervention? At some point, a human (programmer, operator, or what-have-you) has to tell the system that something, somewhere, represents a concept that we'll designate "XHTML" and that the system has to take or avoid certain actions as a result. No computer on earth could figure that out itself from first principles; heck, no computer on earth can even understand first principles. Meaning always starts and ends with human beings. [snip] > So tell me, how do we know that the above is an XHTML div element, > and does it actually matter if it is or it isn't? What I mean is > "is it alright to simply have the property of uniqueness in this > case?" If so, then what about:- > > <myelement xmlns="http://www.w3.org/1999/xhtml" /> > > Or even better:- > > <myelement xmlns="http://www.w3.org/1999/xhtml"> > <div> </div> > </myelement> There's a second property of authority and ownership that is a prerequisite for uniqueness. The idea is that no one but the URI's owner has the authority to invent and define new names in the Namespace designated by the URI. If that condition is not met, the names cannot be guaranteed unique, even at a particular moment. > Remember that this needs to be a practical debate: how useful would > an HTML processor (read: browser) find it to have an XHTML > namespace in all HTML documents? How about the same question for an > XML parser? How about for a Semantic Web engine? > > For the record: I think that an HTML processor could jsut > "recognize" the xmlns. An XML processor would just say "well, it's > unique", and an SW engine would try to dereference it. 1. Applications (i.e. the browser) As you suggest, XML applications (like XHTML browsers) will generally recognize Namespaces (or specific Namespace-qualified names) because they have been provided by humans to the program, either by hard-coding or by some kind of interactive session. Applications also need to have a policy for what to do when unrecognized names (or whole Namespaces) appear -- skip the tags but process the content, skip the whole element, report an error, etc. etc. A good example is the XSL stylesheet, which may have processing rules built in both for xhtml:div and for tei:div -- the Namespaces allow the XSL processor to tell the two apart, and to file the correct rules for the correct element. That's really all Namespaces were ever meant to do. 2. XML Processors The job of XML processors is to pass the Namespace-qualified names on to applications; they don't need to interpret them in any way, even to recognize the fact that they are unique. They may, of course, check that the URIs are syntactically correct, etc. 3. Semantic Web Engine Yes, Virginia, there is a Semantic Web. A little bit of it exists in each of us ... Seriously, behind the whole Semantic Web thing all you'll find is a lot of subtyping -- if an SW program finds a foo:bar element, it is supposed to look through a whole bunch of ancestor schemas until it discovers a supertype of foo:bar that it recognizes, then act on the foo:bar element as if it were an instance of its supertype. As an OO programmer who has not been asleep for a decade, I find it amusing that the SW people are chasing after the kind of deep inheritance that modern OO programmers are trained to avoid by using aggregation, decorators, etc. Anyway, your question is what an SW processor would do -- somehow, it would find a schema for each Namespace (I seem to recall that XML Schemas provided an attribute for that purpose) and then would download the four schemas referred to by that schema, then the four schemas referred to by each of those, etc., until the ninth or tenth level when the system broke down trying to download and parse 4^10 or so schemas to try to interpret a single XML document. Of course, that's assuming that none of the schemas was unavailable or maliciously altered because of security breaches at any one of the hundreds of different hosts being accessed. All the best, David -- David Megginson david@m... http://www.megginson.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