Re: [gdome] how to point to an element in the DOMtree?



On Wed, 2005-05-18 at 14:39 +0530, Sameer Oak wrote:
> But, I am not being able to figure out the way how can I locate to the
> root element of the DOM tree, and Also, for that matter, some other
> element which is a child element of some element?

the gdome_doc_documentElement method does exactly this, it returns the
root element of a DOM document.

As for reaching a particular element, one has indeed the possibilities
you've listed (xpath or walking). In addition, there are a few helper
DOM methods that can be useful, in particular

	getElementsByTagName
	getElementsByTagNameNS

in the Document interface. These methods however can be very inefficient
if used for reaching not just one node but a whole list of nodes. In
this case I'd recommend walking the tree.

Cheers
--luca




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]