How to read an array of values in an XML Node



I think the question makes sense.


I have the following xml:



<?xml version="1.0"?>
<ArrayOfstring xmlns="http://ift.tt/1bQEByM" xmlns:i="http://ift.tt/ra1lAU">
<string>domain\coder1</string>
<string>domain\coder2</string>
</ArrayOfstring>


I am trying to read the two elements into a List.


If I use:



NodeList nList = doc.getElementsByTagName("ArrayOfstring");
....
szCoder = eElement.getElementsByTagName("string").item(i).getTextContent();


In only get "domain\coder1", because my list only has a value of one. If I try using a TagName of "string", I throw a nullpointer.


Any help would be greatly appreciated.


Many thanks in advance


No comments:

Post a Comment