Hi,

I'm not sure what the best way to accomplish this task is.  I would like to
create my own node list by collecting nodes from various DOM API's.  Then
I'd like to use those nodes by passing the list around to different
functions in my code.


I know the following will not work:

        DOM_NodeList domNodeList = getAllChildNodes();
        DOMString dsTemp,dsName;
        dsName = transcode("someNameImLookingFor);
        int listLength = domNodeList.getLength();
        
        for(int i= 0; i<listLength ;i++){
                if(dsName.equals(domNodeList.item(i).getNodeName())) {
                        // myNodeList is a linked list of DOM_Node *
                        myNodeList->append(&(domNodeList.item(i)) );
                }
        }

Here I'm keeping a list of DOM_Node pointers which from what I've read on
this list archive as well as the doc's is a very bad thing to do.  

I came across a post from [EMAIL PROTECTED] that contained this
snippet:

    for (Node n=myparentelement.getFirstChild();
          n!=null;
          n=n.getNextSibling() )
     {
          if(givenTagname.equals(n.getNodeName()))
          {
               ...process it, or add to a list for later processing...
          }
     }

Note that he says "...process it, or add to a list for later processing...
This is what I want to do, but how do I construct and use the list he is
talking about.

I'm getting the feeling that I should probably avoid all this by using a
treewalker or nodeiterator, but I would still like to know how to keep my
own list.

Thanks,

John

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to