```
public static void saveXMLDocument(Document xodrDoc, String absoluteFileName) throws Exception{
    //write the content into xml file                    
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
    DOMSource source = new DOMSource(xodrDoc);
    StreamResult result = new StreamResult(new File(absoluteFileName));
    transformer.transform(source, result);
}

```

So this is how my output file looks like when i try deleting only the "encoding" attribute:

```
<OpenDRIVE>
<header date="Wed May 23 12:21:34 2018" east="0.0000000000000000e+00" name="" north="0.0000000000000000e+00" revMajor="1" revMinor="4" south="0.0000000000000000e+00" version="1.00" west="0.0000000000000000e+00">
</header>
<road id="7" junction="-1" length="1.0000000000000000e+03" name="">
    <link>
    </link>
    <planView>
        <geometry hdg="0.0000000000000000e+00" length="1.0000000000000000e+01" s="0.0000000000000000e+00" x="0.0000000000000000e+00" y="0.0000000000000000e+00">
            <line/>
        </geometry>
        <geometry hdg="0.0000000000000000e+00" length="22" s="1.0000000000000000e+01" x="1.0000087425259599e+01" y="0.0000000000000000e+00">
            <arc curvature="0.10"/>
        </geometry>
    </planView>

```

What should the output be like:

```
<?xml version="1.0" standalone="yes"?>
<OpenDRIVE>
<header revMajor="1" revMinor="4" name="" version="1.00" date="Wed May 23 12:21:34 2018" north="0.0000000000000000e+00" south="0.0000000000000000e+00" east="0.0000000000000000e+00" west="0.0000000000000000e+00">
</header>
<road name="" length="1.0000000000000000e+03" id="7" junction="-1">
    <link>
    </link>
    <planView>
        <geometry s="0.0000000000000000e+00" x="0.0000000000000000e+00" y="0.0000000000000000e+00" hdg="0.0000000000000000e+00" length="1.0000000000000000e+01">
            <line/>
        </geometry>
        <geometry s="1.0000000000000000e+01" x="1.0000087425259599e+01" y="0.0000000000000000e+00" hdg="0.0000000000000000e+00" length="9.9000000000000000e+02">
            <arc curvature="5.0000000000000001e-04"/>
        </geometry>
    </planView>

```

So I know I should not delete the encoding part but it is important to me as otherwise I can't work with this file because I use a special tool for the loading. The excpected output is a pattern I load in my programm. After saving it again I get the current output.

The xml file has to contain the standalone attribute but not the encoding part.