OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] Vocabulary Combination and optional namespaces

[ Lists Home | Date Index | Thread Index ]

Bill de hÓra <bill@dehora.net> wrote:

> The programming problem boils down to this. In a non-namespaceed 
> world, XML elements are self-contained:
>    elementname
> In other words, XML elements are strings, after a kind. In a 
> namespaced world, they are not:
>   elementname, namespace, elementprefix
> In other words namespaced elements are tuples after a kind. You're 
> told to only care about the first two members, but sometimes you do 
> need to care about the prefix (that prefixes have no import is a 
> myth, because XPath makes it a myth)
> For a direct example of how the structural issues of using a tuple 
> affect code, see the SAX startElement call, and try operating on 
> various bits of markup with a handler. For anyone that has Dave 
> Brownell's SAX book, he has a good discussion on this. Or go through 
> the xml-dev archives..
> After that try programming with XPaths against namespaces - the sort 
> of code simplicity Paul is after will be awkward with XPaths. Using 
> an XPath is almost always preferreable to rolling out yet another 
> DOM iterator or SAX stack or some hokey findByFoo API call - until 
> it comes to using namespaces, where managing embedded prefixes can 
> make a NodeList look decidely attractive. Try something like Xalan 
> or Pyana with and without namespaces to get an idea of the 
> differences.
> All the while ask yourself, how to I manage this code with and 
> without namespaces? How do I get the code under control?

Why would you want to?  Why don't you just use the name spaced version and be done with it?  Backwards compatibility? Run it the output through a (trivial) XSLT and strip out the name space, or use blank namespaces and prefixes if you have to do it at the code level (a trivial one time setup issue), but don't use both versions of the API..


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS