I have a xml file:
<Generic_Name>
<Name>
<All>Home</All>
<link>value1</link>
</Name>
<Name>
<All> Filter</All>
<link>value2</link>
</Name>
</Generic_Name>
I need to get the value of <All> tags in a combo box.When the user select the combo box value (that is the value of <All>)its corresponding <link> value need to be printed in the console. I am getting the values of All to the combo box but I cannot get <link> values printed
 DocumentBuilderFactory domFactory = DocumentBuilderFactory
                    .newInstance();
    domFactory.setNamespaceAware(true);
    DocumentBuilder builder = domFactory.newDocumentBuilder();
    Document doc = builder.parse("generic.xml");
    XPath xpath = XPathFactory.newInstance().newXPath();
    // XPath Query for showing all nodes value
    XPathExpression expr = xpath.compile("//Name/*/text()");
    Object result = expr.evaluate(doc, XPathConstants.NODESET);
    NodeList nodes = (NodeList) result;
    final DefaultComboBoxModel assignGp = new DefaultComboBoxModel();
    // for (int i = 0; i < nodes.getLength(); i+)
    int i = 0;
    while (i < nodes.getLength()) {
        assignGp.addElement(nodes.item(i).getNodeValue());
        i = i + 2;
        }
    final JComboBox assignCombo = new JComboBox(assignGp);
    assignCombo.setSelectedIndex(0);
    assignCombo.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        String selct=assignCombo.getSelectedItem().toString();
        // assignGp.getSelectedItem(nodes.item(i).getNextSibling());
        }
        });
    assignCombo.setBounds(150, 180, 140, 25);
    panel.add(assignCombo);
 
     
    
