commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dplot...@yahoo.com>
Subject RE: [jxpath] Using DOM without reloading a file...
Date Thu, 25 Jul 2002 22:33:42 GMT
Per,

You don't actually have to use a container to work with DOM.  JXPath
can work with DOM directly.  If a value of a property, or a value in a
Map or Collection is a Node (any node, not just a Document), JXPath can
traverse into it. You only use a Container if you need the delayed
loading functionality. 

There is nothing wrong with the container class you are proposing, but
it is not required for the traversal of DOM Nodes.

I hope this answers the questions.  Sorry for the late response, I have
been away on vacation.

- Dmitri


--- Per Kreipke <per@onclave.com> wrote:
> Additional question:
> 
> - how about instantiating a container with any DOM Node, not just a
> Document?
> 
> Per
> 
> > It would be nice if JXPath could use an existing DOM model
> > without having to
> > load it itself. Perhaps this isn't possible in the current system
> but...
> >
> > - why not have an additional constructor for XMLDocumentContainer
> which
> > simply sets the document?
> >
> > XMLDocumentContainer(org.w3c.dom.Document doc)
> > {
> > 	this.document = doc;
> > }
> >
> > - alternatively, why is the document object private and not
> protected such
> > that classes can subclass and add their own constructors.
> >
> > - then objects could serve the DOM from an in memory copy
> >
> > - manipulate the DOM outside of JXPath and have those changes
> > automatically
> > reflected.
> >
> >
> > You could just do this by defining a small subclass of Container
> yourself:
> >
> > public class DOMContainer
> > {
> >    Document document;
> >
> >    DOMContainer(Document doc) { this.document = document; }
> >
> >    public Object getValue() { return this.document }
> >
> >    public
> > };
> >
> >
> > or even implementing Container itself on some object that already
> > contains a
> > DOM object.
> >
> >
> > Any reason XMLDocumentContainer doesn't do this (e.g. JXPath
> > caches Pointers
> > that invalidates all of this)?
> >
> > Thanks,
> > Per Kreipke


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message