Windows Dev Center

WriteString

Writes out the specified text content, escaping any markup in the content.


HRESULT WriteString (const WCHAR * pwzText);

pwzText

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

Returns S_OK if no error is generated.

If the value is NULL, this method returns S_OK but does not write any content. In contrast, if pwzText is an empty string, the value written is "".

Surrogate pair characters cannot be split across multiple buffers when this method is called. Therefore, surrogate pairs require special handling. The XML specification defines the valid ranges for surrogate pairs. To write a surrogate pair, see WriteSurrogateCharEntity.

The following code shows the use of WriteString:

if (FAILED(hr = pWriter->WriteString(
           L"Markup is <escaped> for this string")))
{
    wprintf(L"Error, Method: WriteString, error is %08.8lx", hr);
    return -1;
}

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

Header: XmlLite.h

Library: XmlLite.lib

Show:
© 2015 Microsoft