Parsing xml con DOM, DOCTYPE se borra

how come dom con java borra doctype al editar xml?

got este archivo xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE map[ <!ELEMENT map (station*) >
                <!ATTLIST station  id   ID    #REQUIRED> ]>
<favoris>
<station id="5">test1</station>
<station id="6">test1</station>
<station id="8">test1</station>
</favoris> 

a función @my es muy básica:

public static void EditStationName(int id, InputStream is, String path, String name) throws ParserConfigurationException, SAXException, IOException, TransformerFactoryConfigurationError, TransformerException{
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

    DocumentBuilder builder = factory.newDocumentBuilder();
    Document dom = builder.parse(is);

    Element e = dom. getElementById(String.valueOf(id));
    e.setTextContent(name);
    // Write the DOM document to the file
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    FileOutputStream fos = new FileOutputStream(path);
    Result result = new StreamResult(fos);  
    Source source = new DOMSource(dom);


        xformer.setOutputProperty(
                OutputKeys.STANDALONE,"yes"     
                );

    xformer.transform(source, result);
}

está funcionando pero se borra el doctype! y acabo de recibir todo el documento pero sin la parte doctype, lo cual es importante para mí porque me permite recuperarlo por id. ¿Cómo podemos mantener el doctype? ¿Por qué lo borra? Intenté muchas soluciones con las teclas de salida, por ejemplo, u omImpl.createDocumentType, pero ninguna de estas funcionó ...

gracias

Respuestas a la pregunta(4)

Su respuesta a la pregunta