WriteString (IXmlWriterLite)

 

Writes out the specified text content, and escapes 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 (IXmlWriterLite).

The following example 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 complete code example that uses WriteString, see Universal Windows Platform (UWP) XmlLite sample.

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlWriterLite Methods