共用方式為


WriteName

 

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

Syntax

  
HRESULT WriteName (const WCHAR * pwszName);  

Arguments

pwszName
The name to write.. NULL is invalid.

Return Value

Returns S_OK if no error is generated. Returns an error if pwszName is NULL or the name is not valid. An example of an invalid name is one that starts with a colon (":").

Remarks

WriteName ensures that the name is valid according to the Namespaces in XML specification.

The following code shows the use of WriteName:

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

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

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlWriter Methods