Share via


WriteElementString (IXmlWriterLite)

 

Writes out an element by using the specified prefix, name, namespace, and value.

Syntax

  
HRESULT WriteElementString (  
    const WCHAR * pwszQName,  
    UINT cwszQName,  
    LPCWSTR pwszValue);  

Arguments

pwszQName
The qualified name of the element. NULL causes an error.

cwszQName
The length of the element name in wide-character units.

pwszValue
The value of the element. NULL indicates that there is no content to write. In contrast, an empty string indicates that this element has an empty value.

Return Value

Returns S_OK if no error is generated.

Remarks

The following example shows the use of WriteElementString:

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

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

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlWriterLite Methods