Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

Re: [jdom-interest] Namespace.ANY_NAMESPACE

Kevin POCHAT

2006-07-03

Replies:

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 ).getNamespace();

and having testNS equals to Namespace.NO_NAMESPACE.

Thanks for your answers.

Kevin POCHAT

2006/7/3, Michael Kay < mike@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


From: jdom-interest-bounces@jdom.org [mailto:jdom-interest-bounces@jdom.org] On Behalf Of Kevin POCHAT
Sent: 03 July 2006 14:45
To: jdom-interest@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

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.