[jdom-interest] JDOM && Jaxen
Richard Cook
rpc at prismtechnologies.com
Mon Aug 6 09:19:01 PDT 2001
Isn't Namespace more of a variation on singleton than flyweight as there is
no "extrinsic state" which is passed into Namespace methods. It's
specifically one Namespace per prefix/uri pair. The parent could be the
extrinsic state (I think this is mentioned in the book), but this would only
be worthwhile if there were methods on Namespace which needed the parent
(obviously you couldn't pass it in for subsequent return by getParent() ...
:))
I lost the thread of the original xpath query, but could it be solved by
having a getParents() method on Namespace which returned a list of places
the namespace was declared?
-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]On
Behalf Of Elliotte Rusty Harold
Sent: 03 August 2001 12:19
To: jdom-interest at jdom.org
Subject: Re: [jdom-interest] JDOM && Jaxen
At 5:08 PM +0200 8/2/01, Szegedi Attila wrote:
>This definition (which, IMHO should be part of the XML InfoSet spec rather
>than the XPath spec) clearly speaks against flyweights.
No, I don't think it does. The whole point of the flyweight design pattern
is that the client typically doesn't know and doesn't care that all the
different namespace information items are in fact represented by the same
object. We could rewrite JDOM not to use flyweights, and keep exactly the
same public API we have now. No client code would need to change.
The one thing a non-flyweight would let us do that we don't do now is add a
getParent() method to Namespace, though frankly unless we got a Node
interface as well and some other XPath functionality, I don't think it's
worth it.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible, 2nd Edition (Hungry Minds, 2001) |
| http://www.ibiblio.org/xml/books/bible2/ |
| http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ |
+----------------------------------+---------------------------------+
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
More information about the jdom-interest
mailing list