Writes out a comment that contains the specified text.

HRESULT WriteComment (const WCHAR * pwszComment);  

The text of the comment. NULL is equivalent to an empty string.

Returns S_OK if no error is generated.

This method produces a comment in the following format, where text is the text provided:

<!-- text -->  

If the text block provided contains the characters "-->", which denote the end of a comment, this method will insert a space between the two "-" characters. This change to the text prevents the writer from producing an XML document that is not well-formed.

If the pwszComment parameter is NULL, the writer produces a comment that does not contain any text.

For an example of the use of the WriteComment method, see Write an XML Document using XmlLite.

Header: XmlLite.h

Library: XmlLite.lib

IXmlWriter Methods