title: how to update XML data from java
body: <p>I want to change the text content of some field in xml using java.  I used setTextContent() for this, but the xml file is not getting updated. 
  here is my java code:</p>
  
  <pre><code>public static void main(String argv[]) {
    DisclosureTranslation dt=new DisclosureTranslation();
    String filepath="E:\\Repository\\17Nov_demo\\file.xml";
    dt.getHashmap(filepath);
  }
    public void getHashmap(String filepath){
  
  
        try {
              DocumentBuilderFactory documentbuilderfactory=DocumentBuilderFactory.newInstance();
              DocumentBuilder documentbuilder =documentbuilderfactory.newDocumentBuilder();
              Document doc=documentbuilder.parse(filepath);
              XPath xPath = XPathFactory.newInstance().newXPath();
  
              Element element=doc.getDocumentElement();
              NodeList nodelist=(NodeList)xPath.evaluate("/DOCUMENT/ishobject/ishfields/ishfield[@name='FHPIDISCLOSURELEVEL']",
                      doc.getDocumentElement(), XPathConstants.NODESET);
              System.out.println(nodelist.item(0).getTextContent());
  
              String val=nodelist.item(0).getTextContent();
              //String val="111";
  
              HashMap&lt;String, String&gt; hashmap=new HashMap&lt;String,String&gt;();
              hashmap.put("47406819852170807613486806879990", "public");
              hashmap.put("222"," HP Internal");
  
              String value=hashmap.get(val);
  
              nodelist.item(0).setTextContent(value);
              System.out.println(nodelist.item(0).getTextContent());
  
  
              }
  </code></pre>
  
  <p>the last line is displaying what i want. But its not getting reflected in the xml file. How am i suppose to update my xml file?</p>
  
  <p>Thanks in advance! :)</p>