Lists Home |
Date Index |
Joe English wrote:
> Pretty much, yeah. The basic idea is, the application declares
> each of the namespaces it's interested in along with their
> preferred prefixes. Then when a document is parsed, element
> and attribute names are rewritten to use the application's
> namespace prefix bindings. This gives application authors
> the same kind of convenient shorthand that the Namespaces REC
> gives document authors.
What concerns me about this approach is that somewhere there needs to be
a namespace cache, and this object needs to be global or passed to each
method that needs to handle namespaces. Plus you're going to want
different caches for different documents, so you need to find the right
cache. Maybe you can store it in the Document object itself, but what if
the namespaces change from one scope to the next? I suspect this is
going to produce really ugly code in traditional languages like C# and
Java. But maybe I'm wrong. If somebody could figure out how to design
this in a clean way, it would be interesting to see.
Languages like XPath/XQuery/RNC have the advantage of being able to
build in their own namespace mappings as syntax features, rather than
having to graft this on to objects somewhere. So when you get to write
the entire language, I think you can make this work. But to convince me
this could work in Java/C#/Python/Perl etc., you're going to need show
me an API that uses qualified names instead of local names and URIs that
works and is at least as clean as existing APIs.
Elliotte Rusty Harold firstname.lastname@example.org
XML in a Nutshell 3rd Edition Just Published!