Issue to parse XML file

i not able to get in correct way value from Xml file parsing it.

For <checkboxes_pizza> i get the correct while while for <checkboxes_bevande> i not able to get the correct <id> in fact i get two times(so the same) the id of <checkboxes_pizza>.
If <checkboxes_pizza> <id> 2 </id> </checkboxes_pizza> and <checkboxes_bevande> <id> 3 </id> </checkboxes_bevande> i get 2 two times not 2 and 3.
I don’t know why!

I show you XML structure and code!

Thanks everybody for the help!

.XML

enter image description here

code to parse:

 @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
 checkboxPizza(data);

        checkboxBevande(data);
}


   private void checkboxPizza(Intent data) {
        filePath = data.getData();
        System.out.println("FILEPATH" + filePath);


        path = FilePath.getPath(this, filePath);

        System.out.println("PATH" + path);

        int a=0;
        int b=0;

        String status="";
        boolean statuss = false;
        String intenttt= path;

        System.out.println("INTENT:" + intenttt);



        file = new File(intenttt);
        System.out.println("FILE:" + file);

        FileInputStream is = null;
        try {
            is = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = null;
        try {
            dBuilder = dbFactory.newDocumentBuilder();
        } catch (ParserConfigurationException e) {
            e.printStackTrace();
        }
        Document doc = null;
        try {
            doc = dBuilder.parse(is);
        } catch (SAXException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        Element element = doc.getDocumentElement();
        element.normalize();

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

        for (int i = 0; i < nList.getLength(); i++) {
            Node node = nList.item(i);

            if (node.getNodeType() == Node.ELEMENT_NODE) {
                Element element2 = (Element) node;
                //tv1.setText(tv1.getText()+"/nName : " + getValue("name", element2)+"/n");

                String id = getValue("id", element2);
                a = Integer.parseInt(id);
                status = getValue("status", element2);

                statuss= Boolean.parseBoolean(status);

                System.out.println("XML:" + a);
                hm.clear();

                hm.add(a);

                System.out.println("AZZ:" + hm);





            }

        }
        Bundle bundle = new Bundle();
        bundle.putIntegerArrayList("oki", hm);
        System.out.println("PERO:" + bundle);

        MyListFragment myFragment = new MyListFragment();
        myFragment.setArguments(bundle);
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.a, myFragment);
        // transaction.replace(R.id.b, myFragment2);


        transaction.commit();

    }



 private void checkboxBevande(Intent data) {
        filePath = data.getData();
        System.out.println("FILEPATH" + filePath);


        path = FilePath.getPath(this, filePath);

        System.out.println("PATH" + path);

        int a=0;
        int b=0;

        String status="";
        boolean statuss = false;
        String intenttt= path;

        System.out.println("INTENT:" + intenttt);



        file = new File(intenttt);
        System.out.println("FILE:" + file);

        FileInputStream is = null;
        try {
            is = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = null;
        try {
            dBuilder = dbFactory.newDocumentBuilder();
        } catch (ParserConfigurationException e) {
            e.printStackTrace();
        }
        Document doc = null;
        try {
            doc = dBuilder.parse(is);
        } catch (SAXException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        Element element = doc.getDocumentElement();
        element.normalize();

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

        for (int i = 0; i < nList.getLength(); i++) {
            Node node = nList.item(i);

            if (node.getNodeType() == Node.ELEMENT_NODE) {
                Element element2 = (Element) node;
                //tv1.setText(tv1.getText()+"/nName : " + getValue("name", element2)+"/n");

                String id = getValue("id", element2);
                a = Integer.parseInt(id);
                status = getValue("status", element2);

                statuss= Boolean.parseBoolean(status);

                System.out.println("XML:" + a);
                hm2.clear();

                hm2.add(a);

                System.out.println("AZZ:" + hm);





            }

        }
        Bundle bundle2 = new Bundle();
        bundle2.putIntegerArrayList("oki2", hm);
        System.out.println("PERO:" + bundle2);

        ThreeFragment myFragment2 = new ThreeFragment();
        myFragment2.setArguments(bundle2);
        FragmentTransaction transaction2 = getSupportFragmentManager().beginTransaction();
        transaction2.replace(R.id.b, myFragment2);


        transaction2.commit();
    }


private static String getValue(String tag, Element element) {
        NodeList nodeList = element.getElementsByTagName(tag).item(0).getChildNodes();
        Node node = nodeList.item(0);
        return node.getNodeValue();
    }