Continuously updating a web page with XML file
===

I am having a small problem loading an XML file to a web page and displaying the information contained within it. For this program, I am trying to update a very simple web page with a constant stream of data that is loaded to an XML file. When my program finds new data, (which is usually once every few seconds), it modifies the XML file and saves it. Another web client (within Netbeans) runs the web page that displays this information. As of right now my problem is that when I refresh the page, no new data appears (the same values are still there even though I know they should not be). I then check the XML file and the new data is present so it is successfully writing to it. The strange thing is once I open the xml file to check the information, the web page will update itself once I refresh the page. That seems to be the only way to update the web page is if I open the xml file by myself. My question is does anyone know what is going on and can you provide a way to solve this. 
I have provided my ModifyXML.java code and index.jsp page for reference

**Modify XML**

    import java.io... //all import statements not shown
    public class ModifyXML {

    //provide the byte array and the number of the sensor that needs to be 
    //updated in the XML file
    public ModifyXML(byte[] array, int signal) {

        try {
            //create a new Document Builder to modify the XML file 
            String filepath = "C:\\user\\projects\\onlineClient\\web\\HTTP.xml";
            DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
            Document doc = docBuilder.parse(filepath);


            // Get the root element
            Node Sensor = doc.getFirstChild();

            // Get the staff elements by tag name directly
            Node data = doc.getElementsByTagName("Data").item(0);
            Node data2 = doc.getElementsByTagName("Data2").item(0);

         /* Methods to update the information are not shown as they work fine (it saves space)*/


            
            // write the content into xml file
            TransformerFactory transformerFactory = TransformerFactory.newInstance();
            Transformer transformer = transformerFactory.newTransformer();
            DOMSource source = new DOMSource(doc);
            StreamResult result = new StreamResult(new File(filepath));
            transformer.transform(source, result);

            System.out.println("Done");

        } catch (ParserConfigurationException pce) {
            pce.printStackTrace();
        } catch (TransformerException tfe) {
            tfe.printStackTrace();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        } catch (SAXException sae) {
            sae.printStackTrace();
        }
    }

       }

**index.jsp**

    <html>
    <title>Home Monitor Web Client</title>
    <body>
    <h1>Home Monitor</h1>
    <p id="demo">Paragraph.</p>
    
    <p id="demo2">Paragraph.</p>
    
    <br>
    
    <p id="demo3">Paragraph.</p>
    
    <p id="demo4">Paragraph.</p>

    <script type="text/javascript">
    if (window.XMLHttpRequest)
       {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.open("GET","HTTP.xml",false);
    xmlhttp.send();
    xmlDoc=xmlhttp.responseXML;

    //document.write("<table border='1'>");
    var data=xmlDoc.getElementsByTagName("data");
    var data2=xmlDoc.getElementsByTagName("data2");
    for (i=0;i<temperature.length;i++)
      {
      document.getElementById("demo").innerHTML="ID Number: "+data[i].getElementsByTagName("ID")[0].childNodes[0].nodeValue;
      document.getElementById("demo2").innerHTML="Reading: "+data[i].getElementsByTagName("Value")[0].childNodes[0].nodeValue;
     document.getElementById("demo3").innerHTML="ID Number: "+data2[i].getElementsByTagName("ID")[0].childNodes[0].nodeValue;
     document.getElementById("demo4").innerHTML="Reading: "+data2[i].getElementsByTagName("Value")[0].childNodes[0].nodeValue;
       }
    </script>

    </body>
    </html>