Share via


WriteWhitespace

 

Writes out the specified white space.

Syntax

  
HRESULT WriteWhitespace (const WCHAR * whitespace);  

Arguments

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

Return Value

Returns S_OK if no error is generated.

Remarks

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 Write an XML Document using XmlLite.

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlWriter Methods