You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Gerardo Fdez." <ge...@imaginando.org> on 2001/11/28 01:30:34 UTC

Direct access to nodes on a DOM tree

Hi!

My app needs access to so different and unsorted nodes of a DOM Tree,
i'm trying to get a way to keep info from each node (DOM_Node) to access
them directly whenever i need in my program saving this info in an array
or struct by example.

I'm new to Xerces and DOM and a bit confused about xerces api.

¿any idea?


-- 

                                                   CU, Gerardo.




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: Direct access to nodes on a DOM tree

Posted by Erik Rydgren <er...@mandarinen.se>.
The actual overhead of keeping DOMNodes just as they are is about 4 bytes. A
Node only contain a pointer to a reference counted implementation of the
actual Node data. So you can feel free to keep nodes just as you like as
long as you do not allocate them on the heap (NO allocation of DOM objects).
Stick them in a vector, list, hash or whatever. Just make sure that you
release the node implementation by setting the cached nodes to 0 (yourNode =
0) to be able to drop documents from memory.

And of course some pseudo code (hey it is me remember) :)

doc = Load_document()
for_each_node_in(doc)
  if wanted(node)
    vector.push_back(node)
do_your_stuff_on(vector)
for_each_node_in(vector)
  node = 0 // Release node implementation
doc = 0 // Release document memory (if last handle to document)

Regards

Erik Rydgren
Mandarinen systems AB
Sweden

-----Original Message-----
From: Gerardo Fdez. [mailto:gerardo@imaginando.org]
Sent: den 28 november 2001 01:31
To: xerces-c-dev@xml.apache.org
Subject: Direct access to nodes on a DOM tree


Hi!

My app needs access to so different and unsorted nodes of a DOM Tree,
i'm trying to get a way to keep info from each node (DOM_Node) to access
them directly whenever i need in my program saving this info in an array
or struct by example.

I'm new to Xerces and DOM and a bit confused about xerces api.

¿any idea?


--

                                                   CU, Gerardo.




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org