Partager via


WriteString (Compact 7)

3/12/2014

This method writes out the specified text content, escaping any markup in the content.

Syntax

HRESULT WriteString (
  const WCHAR* pwzText
);

Parameters

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

Return Value

This method 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. 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 an example 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;
}

See Also

Reference

IXmlWriter Methods
WriteSurrogateCharEntity
IXmlWriter Properties