|
|
 |
Article:
 |
 |
XML Namespaces Don't Need URIs
|
| Subject: |
Namespace prefix registry |
| Date: |
2005-04-15 17:50:36 |
| From: |
mikeday |
|
Response to: Namespace prefix registry
|
|
|
No, I don't think parsers have any need at all for a list of prefixes or any hard-coded associations.
The examples I gave of a web browser recognising <html> or an XSLT processor recognising <xsl:transform> do not require the parser to do anything with prefixes and do not require a list of important namespaces.
So I would agree with your point 4., that there is essentially no need for namespaces whatsoever, given the current meaning of the term. As to "how they are actually used", surely the XSLT use of namespaces is one of the most widely used; that was why I chose to discuss it.
I would be interested in counter-examples from actual real use cases, though, as so far I have only seen hypothetical ones.
|
Previous Message
|
Up
|
Next Message
|
- Namespace prefix registry
2005-04-16 03:29:58 bryan rasmussen
[Reply]
The actual use of namespaces, as opposed to the stated reason for their existence and predating XML Schema which has a bad model for this usage of namespaces, is to allow the extensibility of applications with data not understood by a particular application X but understandable by a particular application Y or some developer's homemade script for example. This takes advantage of the general habit of applications targetting various xml dialects of ignoring what they do not understand in an unknown namespace (xhtml, svg, xsl-fo) certainly this could be done without using namespaces but would lead to other problems vis-a-vis validation. Also there are certain xml formats such as XMI or the xml serialization of RDF that can be considered as helper formats, these formats also happen to have names of both elements and attributes that could give rise to name collisions (Description springs immediately to mind), one could get around this problem by making sure one gave all elements and attributes unlikely to be duplicated names, such as RDFDescription but that would just add to the ugliness of syntax in another way than namespaces and would probably lead to confusion from newbies anyway (as in why don't we just call it Description?!?), to get around this problem somebody somewhere would probably then suggest that we need namespaces.
I made the mention of XML Schema because as noted it has a bad model for this usage of namespaces, so as to build extensibility into the validation of xml schema one often uses the any construction at various places, which can be used to associate extensible content with specific namespaces and so forth. This indicates another little useful aspect of namespaces for programming in that namespaces allow one to refer to sets of elements and attributes generically, for example the xpath //html:* would allow you to get all xhtml elements given that you had associated with the namespace, this can of course also be done in other APIs to XML, this is a real time saver. I can think of other ways this could be done, but these ways would be far from trivial, if you can think of a trivial way to do it please point it out, and I should think the way should be described somewhat concretely.
This facility of mixing namespaces is of course very important to the concept of compound documents.
|
 |
Sponsored By:
|