public void commitFile() {
        try {
            DOMImplementationLS domImplementationLS
                    = (DOMImplementationLS) doc.getImplementation().getFeature("LS", "3.0");
            LSOutput lsOutput = domImplementationLS.createLSOutput();
            FileOutputStream outputStream = new FileOutputStream("userstock.xml");
            lsOutput.setByteStream((OutputStream) outputStream);
            LSSerializer lsSerializer = domImplementationLS.createLSSerializer();
            lsSerializer.write(doc, lsOutput);
            outputStream.close();
        } catch (Exception e) {
            System.out.println("Error in updating");
        }
    }