Writes out the specified white space.

HRESULT WriteWhitespace (const WCHAR * whitespace);


The white space to write. NULL is valid and indicates that no operation is to be performed.

Returns S_OK if no error is generated.

Use this method to manually format an XML document.

When the whitespace parameter is NULL, this method returns S_OK without writing any content. In contrast, if the parameter is an empty string, the value written is "".

The following code shows the use of WriteWhitespace:

if (FAILED(hr = pWriter->WriteWhitespace(L"\n")))  // Output a newline.
    wprintf(L"Error, Method: WriteWhitespace, error is %08.8lx", hr);
    return -1;

For a more detailed example of WriteWhitespace, see Writing an XML Document Using XmlLite.

Header: XmlLite.h

Library: XmlLite.lib

© 2015 Microsoft