WriteComment (IXmlWriterLite)


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.

Return Value

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 pwszComment contains the characters "-->", which signify the end of a comment, this method inserts 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 a complete code example that uses WriteComment, see Universal Windows Platform (UWP) XmlLite sample.


Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlWriterLite Methods