title: update xml file using java xpath knowing absolute path
body: <p>for example we have this file xml</p>
  
  <pre><code> &lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;config&gt;
    &lt;Connections&gt;
      &lt;DbMetaData tablePrefix="example"/&gt;
      &lt;Date&gt;inOut&lt;/Date&gt;
      &lt;AGSConnection
                    outputDirectory="C:\directory2\directories\isoutput"
                    virtualOutputDirectory="https://directory1.example1.net/ex/rest/output"/&gt;
      &lt;SDEConnection
                    server="srv01" 
                    instance="sde:sqlserver:srv01" 
                    database="DBex" 
                    authenticationMode="DBMS"
                    user="user1" 
                    password="pass123" 
                    version="sde.DEFAULT"
                    sdeConnectionPath="C:\\tmp\\ex\\conexion\\ser01.sde"/&gt;
   &lt;/Connections&gt;
   &lt;/config&gt;
  </code></pre>
  
  <p>if we want to edit the values in nodes "new value" and "server=new value" using xpath, which would be the code?
  I wrote the following code but does not work, do not give me error messages, simply generate the new XML file but without changes:</p>
  
  <pre><code>            File file = new File(fileXML);
              DocumentBuilder dBuilder=DocumentBuilderFactory.newInstance().newDocumentBuilder();
              doc = dBuilder.parse(file);         
              XPath xPath = XPathFactory.newInstance().newXPath();
              String expression = "/config/Connections/SDEConnnection/server";
              NodeList nodes = (NodeList)xPath.evaluate(pathNodo,doc, XPathConstants.NODESET);         
              for (int idx = 0; idx &lt; nodes.getLength(); idx++) {
                  Node node = nodes.item(idx);
                  node.setTextContent(valorNodo);
              }        
              Transformer transformer = TransformerFactory.newInstance().newTransformer();
              transformer.transform(new DOMSource(doc), new StreamResult(new File("C:/test.xml")));
  </code></pre>
  
  <p>what would be the correct expression to edit the value on each node:
  "new value"--/config/Connections/Date
  "server=new value"--/config/Connections/SDEConnnection/server</p>
  
  <p>thanks,</p>