I am loading an XML file in to DOM using DocumentBuilder.parse(File file).
I have written an XML writer which takes a DOM and writes it to file I have tested this and know it works as expected when creating a new DOM in memory.
However when I create a DOM from an existing xml file then write it to disk using my xml writer there are blank line or carriage returns in the new file which didn't exist in the original. I suspect these are being inserted when the DOM is created from an existing file but can't prevent or solve it. Does anyone have an explanation or ideas to prevent or solve.