Partager via


WriteAttributes (IXmlWriterLite)

 

Copies attributes from the specified source IXmlReader to the IXmlWriterLite.

Syntax

  
HRESULT WriteAttributes (IXmlReader * pReader, BOOL fWriteDefaultAttributes);  

Arguments

pReader
The reader to copy the attributes from. This argument cannot be NULL.

fWriteDefaultAttributes
Specifies whether to also copy the default attributes from the reader.

Return Value

Returns S_OK if no error is generated.

Remarks

The attributes copied depend on the current position of the reader:

  • If the reader is positioned on an element node, this method copies all of the attributes that are contained by the element.

  • If the reader is positioned on an attribute node, this method copies the current attribute and the rest of the attributes that are contained by the element.

  • If the reader is positioned on an XmlNodeType_XmlDeclaration, this method writes out all the attributes of the declaration.

  • If the reader is positioned on any other node type, calling this method has no effect.

The following example writes out all the attributes located at the current position in the specified reader:

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

Requirements

Header: XmlLite.h

Library: XmlLite.lib

See Also

IXmlWriterLite Methods