I have to walk a tree that reaches me from a NodeList, I need an algorithm to traverse all nodes in order, most likely be in depth but not how to implement it. I think I need some recursion. Can anybody help?

The part of the code is:
 NodeList nodeLista = documento.getElementsByTagName("html");

```
for (int s = 0; s < nodeLista.getLength(); s++) {
    Node Raiz = nodeLista.item(s);

```

....

```
    for (int h = 0; h < nodeLista.getLength(); h++) {

    //Level of depth 1.
    Node Primer_Hijo = nodeLista.item(h); // In the first iteration for the HEAD will enter in the second iteration enter the BODY.

    //Level of depth 2.
    Element SegundoElemento = (Element) Primer_Hijo;
    NodeList ListadeNodos2 = SegundoElemento.getChildNodes();

```

.....