Getting arrays from strings.xml
<p>I want to get the arrays from my <code>strings.xml</code> file.<br>
I have set up Spinners and Buttons.</p>

<pre><code>&lt;string-array name="angles"&gt;
    &lt;item value="1"&gt;Radian&lt;/item&gt;
    &lt;item value="(Math.PI/3200)"&gt;Mil&lt;/item&gt;
    &lt;item value="(Math.PI/200)"&gt;Grad&lt;/item&gt;
&lt;/string-array&gt;
</code></pre>

<p>I managed to get the values but rest is a puzzle to me:</p>

<pre><code>public class parser {

public static void main(String argv[]) {

    try {

        File fXmlFile = new File("/home/frac/AndroidStudioProjects/UnitConverter/app/src/main/res/values/strings.xml");
        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        Document doc = dBuilder.parse(fXmlFile);


        doc.getDocumentElement().normalize();

        System.out.println("Root element :" + doc.getDocumentElement().getNodeName());

        NodeList nList = doc.getElementsByTagName("item");



        for (int temp = 0; temp &lt; nList.getLength(); temp++) {

            Node nNode = nList.item(temp);

            System.out.println("\nCurrent Element :" + nNode.getNodeName());

            String deger = nNode.getNodeValue();



            if (nNode.getNodeType() == Node.ELEMENT_NODE) {

                Element eElement = (Element) nNode;

                System.out.println( eElement.getAttribute("value"));


            }




        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

}
</code></pre>