Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Scope of namespaces

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Steve Loughran <steve.loughran AT gmail.com>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Scope of namespaces
  • Date: Mon, 6 Feb 2006 10:48:02 +0000

On 2/6/06, Michael Kay <mike AT saxonica.com> wrote:
>
> > OK. This is weird. What's the use case? Why do you need to know if a
> > particular namespace URI is in scope for some prefix irrespective of
> > some particular prefix? I can't say I've ever needed to do that.
>
> I have come across XML vocabularies in which the presence of a namespace
> declaration for a particular URI carries semantics - such as telling you
> which version of the spec the document conforms to - irrespective of the
> fact that the prefix bound to that URI is never used within the document,
> either in element or attribute names or in content.


good point.

When Ant1.6+ hits a namespace decl beginning with the schema antlib:
it actually looks for and loads a resource file on the current
classpath

http://ant.apache.org/manual/CoreTypes/antlib.html

However, if it doesnt find it yet, or hits an error, it doesnt
actually complain until you try and use a task/type in that namespace
in which case it remembers that it had trouble and throws up the
problem.

I guess that means that the xmlns declaration itself doesnt have side
effects, only use of the elements. Though you could abuse the antlib
xml file by defining new java classes that implement the relevant
interface that lets you insert them into an antlib. So you could make
the declaration side effecting if you really wanted to.

-Steve




Archive powered by MHonArc 2.6.24.

Top of Page