[jdom-interest] Element.getDocument() ?

bob bob at accurev.com
Thu Aug 31 05:52:48 PDT 2000


	/comment()

	Given any Element from the doc, get any Comment node
	that is a peer of the root element.  Not owned by the
	root element, but at the same level as it.

	XPaths deal strictly in terms of Elements.  (In fact,
	the spec doesn't mention Document at all, but does
	include a concept of an Element which holds the root
	element, and Comments and ProcInstrs which are 
	siblings of the root element.)

	Right now, an XPath maintains no state related to
	the Element being walked.  Which is good.  Cache
	an XPath from an XSLT stylesheet, annd apply to multiple
	different souce .xml documents.

		-bob

On Thu, 31 Aug 2000, Joerg wrote:

> Can you explain it to me, what is the problem in the XPath implementation where you need
> the method? A recursive getParent() seems also not to be very efficient. Maybe it is
> possible to keep the owner Document somewhere in the XPath classes or keep track of it,
> by passing it seperately to the necessary functions.
> 
> Joerg
> 
> bob wrote:
> 
> > Probably just recursively getParent() until isRootElement(),
> > and hold a reference to the Document there.  Maybe.
> >
> >         -bob
> >
> > On Thu, 31 Aug 2000, Joerg wrote:
> >
> > > How do you want to do that? Do you want to put a referencce to a Document in every
> > > Element? When you do it like this, you have to update all Elemets when you copy a
> > > subtree from one Document to another. This would be the same "ownerDocument" -
> > > "cloneNode" problem like in DOM.
> > >
> > > Joerg
> > >
> > >
> > > bob wrote:
> > >
> > > > > > Currently, there appears to be no way to obtain the Document
> > > > > > which owns a particular Element.
> > > > >
> > > > > I'm OK with this, but I don't have the time to make the changes. There
> > > > > would need to be changes in Element.java, PartialList.java, and
> > > > > Document.java, as far as I can tell.
> > > > >
> > > > > Wanna do them, Bob?
> > > >
> > > > Sure.  Though, I'm offline until next Wednesday.  So, I'll submit
> > > > a patch mid-to-late next week.
> > > >
> > > >         -bob
> > > >
> > > > _______________________________________________
> > > > To control your jdom-interest membership:
> > > > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> > >
> > >
> 
> 
> 




More information about the jdom-interest mailing list