cancel
Showing results for 
Search instead for 
Did you mean: 

how to access child node??

anibal_alonso
Explorer
0 Kudos

Hi, I have an application where there is a parent node has a child node. I want access to that child node, how I can do? I used this code, but always get the first child node of the first parent node, can anyone help?

for(int i= 0; i<wdContext.nodeObtenerReferenciaReturnContSap().size(); i++){

         

          IObtenerReferenciaReturnContSapElement element =                     wdContext.nodeObtenerReferenciaReturnContSap().getObtenerReferenciaReturnContSapElementAt(i);

             

          for(int j=0; j<wdContext.nodeObtenerReferenciaReturnContSapFunc1().size(); j++){

            

                     IObtenerRefReturnContSapFunc1Element funcional1 = (IObtenerRefReturnContSapFunc1Element)                               wdContext.nodeObtenerRefReturnContSapFunc1().getElementAt(j);

          ....

          }

}

where nodeObtenerReferenciaReturnContSap is the parent node, and nodeObtenerReferenciaReturnContSapFunc1 is the child node, regards.

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

getChildNode("nodename", index);

anibal_alonso
Explorer
0 Kudos

but to access that function I have to do:

wdContext.nodeObtenerReferenciaReturnContSap().getChildNode(...);

But if I want to get the child node of a parent node "X", because I don't do:

IObtenerReferenciaReturnContSapElement element = wdContext.nodeObtenerReferenciaReturnContSap().getObtenerReferenciaReturnContSapElementAt(i);

element.getChildNode(...) <-- This don't exist

how do I do it? thanks.


junwu
Active Contributor
0 Kudos

you get the child node from parent node, not from the parent element...

the index means under which element the child node should be retrieved.

anibal_alonso
Explorer
0 Kudos

Thanks Jun Wu, I resolved the problem doing this before to access the child node:

...

for(...){

     wdContext.nodeObtenerReferenciaReturnContSap().moveTo(i);

    

     for(,,,){

     }

}

...

Answers (0)