Writes out the specified name, ensuring that the name is a valid NmToken according to the XML specification.

HRESULT WriteNmToken (const WCHAR * pwszNmToken);  

The name to write. NULL is invalid.

Returns S_OK if no error is generated. Returns an error if pwszNmToken is NULL or the name is not a valid NmToken.

If NULL is supplied for the name, an error is returned.

The following code shows the use of WriteNmToken:

if (FAILED(hr = pWriter->WriteNmToken(L"myNmToken")))  
    wprintf(L"Error, Method: WriteNmToken, error is %08.8lx", hr);  
    return -1;  

For a more detailed example of WriteNmToken, see Write an XML Document using XmlLite.

Header: XmlLite.h

Library: XmlLite.lib

IXmlWriter Methods