I want to create XML in Java.
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder;
docBuilder = dbfac.newDocumentBuilder();
Document doc = docBuilder.newDocument();
but Java automatically creates declaration like this
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
How can I remove encoding="UTF-8" standalone="no"
so it will be
<?xml version="1.0"?>
Thanks!
Why do you need to remove an encoding? But..
doc.setXmlStandalone(true);
will erase standalone="no"