This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
But I want to remove the encoding="UTF-8" attribute and want the entire XML without any spaces/new line characters like below...
<?xml version="1.0"?><root><doc><info><docDescription> blah blah.... </root>
I don't see an XmlWriter class in the standard Java API. (I see an XmlWriter interface but it doesn't match what's in your code.) So is this somebody else's XmlWriter? Somebody else with a forum or a mailing list?
Ah, I see. So the documentation answers one of your questions when it says
The XML declaration and processing instructions are always on their own lines.
And it appears to answer the rest of your questions when it says
An OutputFormat object can be used to define how whitespace is handled when printing and allows various configuration options, such as to allow suppression of the XML declaration, the encoding declaration or whether empty documents are collapsed.
So apparently you need to do something different with the OutputFormat you are creating. I assume you're going through this exercise because the mainframe people have an XML parser which makes unreasonable demands about its input?