[jdom-interest] Namespace.ANY_NAMESPACE

Kevin POCHAT kpochat at gmail.com
Mon Jul 3 08:15:52 PDT 2006

Concerning (a), I think a wildcard namespace is as much a namespace as
Namespace.NO_NAMESPACE, and designing a special class just for this case
might be a too heavy design (i'm thinking about performances, code
compactness, and ease for the JDOM user).

For (b), I think "any namespace or none" would be more useful. It could help
to be able to, for example, do this :

Element foo;
Namespace testNS = foo.getAttribute("bar",Namespace.ANY_NAMESPACE

and having testNS equals to Namespace.NO_NAMESPACE.

Thanks for your answers.


2006/7/3, Michael Kay <mike at saxonica.com>:
>  Searching when you only know the localName can be useful, but a couple of
> observations:
> (a) your proposed object (the wildcard) is not a Namespace, so it is wrong
> to model it as one. Correct design would change the method to accept a
> "NamespaceTest" object which could be either a Namespace or a
> NamespaceWildcard.
> (b) you need to think carefully about whether you want to match "any
> namespace", or "any namespace or none". Remember that technically, (and very
> inconveniently) unqualified attribute names are not in any namespace: it's
> wrong to refer to them as being in some default, unnamed, or null namespace.
> Michael Kay
> http://www.saxonica.com/
>  ------------------------------
> *From:* jdom-interest-bounces at jdom.org [mailto:
> jdom-interest-bounces at jdom.org] *On Behalf Of *Kevin POCHAT
> *Sent:* 03 July 2006 14:45
> *To:* jdom-interest at jdom.org
> *Subject:* [jdom-interest] Namespace.ANY_NAMESPACE
> Hi,
> I'm working on an app using a DTD to generate JDOM-based XML Parsers.
> When I use calls to Element.getAttributeValue() I don't necessarily know
> what is the namespace of the looked up attribute.
> Would it be considered as useful or as a sacrilege to implement a static
> Namespace to be used as a "wildcard" namespace ?
> If useful, do you have any guidlines concerning various points to take
> care of during such a development ? I currently just set it to be taken in
> consideration in the Namespace.equals(Object ob) method.
> Thanks,
> Kevin POCHAT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20060703/56679d8c/attachment.htm

More information about the jdom-interest mailing list