Estou precisando set no xml o standalone para yes.
meu código esta assim:
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
...
Document document = DocumentHelper.createDocument();
Element dataPacket = document.addElement("DATAPACKET");
dataPacket.addAttribute("Version", "2.0");
Element metadata = dataPacket.addElement("METADATA");
...
Writer str = new java.io.StringWriter();
writer = new XMLWriter();
OutputFormat formatXML = new OutputFormat.createPrettyPrint();
formatXML.setEncoding("UTF-8");
formatXML.setTrimText(false);
formatXML.setNewLineAfterDeclaration(false);
writer = new XMLWriter(str, formatXML);
writer.write(document);
System.out.println(str.toString());
entretanto a saída esta:
<?xml version="1.0" encoding="UTF-8"?>
<DATAPACKET Version="2.0">
<METADATA>
</METADATA>
</DATAPACKET>
como faço para colocar o standalone ?
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>