Writes out an entity reference with the specified name.

HRESULT WriteEntityRef (const WCHAR * pwszName);  

The name of the entity reference. NULL is not valid.

Returns S_OK if no error is generated.

This method produces an entity reference in the following format, where name is the name provided:


This method returns an error if NULL is supplied for the name.

The following code shows the use of WriteEntityRef:

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

For an example of WriteEntityRef, see Write an XML Document using XmlLite.

Header: XmlLite.h

Library: XmlLite.lib

IXmlWriter Methods