|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: RE: Namespaces Best Practice
At 10:57 AM 9/20/2001 -0700, David Brownell wrote: >But aren't there issues like "how far do you bubble down"? >Normally I'll think that certain nodes in a given document will >be natural spots to bubble down to, even if some decls could >get bubbled down even further. This is where the problems start to get interesting. From the point of view of least-number-of-declarations, you need to check a big chunk of the tree to put namespace declarations in the element which is one above where the namespace actually gets used. Putting namespace declarations in where they are used (tight scoping) works well when a namespace only appears once, but produces piles of declarations that could have been avoided when a namespace appears lots of time over the course of a document but is scattered. (XLink tends to do that, but there are lots of other cases.) It's the kind of problem humans are generally good at solving but which take some algorithmic tree-trickery to solve efficiently on a computer. As a guideline, I'm pretty happy with "declare all namespaces on the root element whenever possible", while still recognizing that isn't always possible. Finally, I don't think variable-scoping is a useful comparison for namespace-scoping in XML documents. There aren't a lot of XLink-attribute-like things that get used in a scattered way across a Java program but are still in the same namespace, for instance. Variable scoping is nicely contained by the logic of program flow, while namespace scoping may be much more arbitrary. Simon St.Laurent Associate Editor O'Reilly & Associates, Inc.
|
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
|
|||||||||

Cart








