[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Vocabulary Combination and optional namespaces

  • To: Bill de hÓra <bill@d...>, "Arjun Ray" <aray@n...>
  • Subject: RE: Vocabulary Combination and optional namespaces
  • From: "Hunsberger, Peter" <Peter.Hunsberger@s...>
  • Date: Mon, 2 Jun 2003 10:45:11 -0500
  • Cc: <xml-dev@l...>
  • Thread-index: AcMnVqMMGF7RST3BQVmIWkWtyrsY0ABxqgNA
  • Thread-topic: Vocabulary Combination and optional namespaces

xpaths and namespaces
Bill de hÓra <bill@d...> wrote:

<snip/>
 
> 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..





PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.