Freigeben über


WriteString

 

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

Syntax

HRESULT WriteString (const WCHAR * pwzText);

Arguments

  • pwzText
    The text 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

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

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlWriter Methods