Your code looks correct as is. You have childNode
when it should be childNodes
in the NAME
assignment, but I'm assuming that is just a typo in your question.
Your XML isn't valid though. You need to have some kind of root node wrapping the servers. As it's currently written, I wouldn't expect that to even parse successfully. It should look something like this:
<servers>
<server>
<host> HOST1 </host>
<port> 6667 </port>
<channel>
<name> CHANNAME1</name>
</channel>
<channel>
<name> CHANNAME2 </name>
</channel>
</server>
<server>
<host> HOST2 </host>
<port> 6667 </port>
<channel>
<name> CHANNAME3 </name>
</channel>
</server>
</servers>
With that XML, and the code you've provided, I get the exact output you expect.