There is such a dock:
<root> 1 <tr> a <tr> aa </tr> <fls> bb </fls> </tr> <fls> <tr> aaa </tr> <fls> bbb </fls> </fls> </root> And this code:
element = doc.getDocumentElement(); NodeList nlist = element.getChildNodes(); System.out.println(nlist.getLength()); Why, then, do I get a length of 5 Whereas, how should I get 2, if doc.getDocumentElement(); gives me root which contains 2 children
rootelement contains a child nodetr, a nodefls, a text node\n\t1\n\tand two more text nodes\n\t. - Sergey Gornostaev