Type Reason ArgumentException ws is null or string.Empty or contains non-white space characters. InvalidOperationException The XmlWriter.WriteState is WriteState.Closed.
This method is used to manually format your document.
For the asynchronous version of this method, see XmlWriter.WriteWhitespaceAsync(string).