Mono Class Library: System.Xml.XmlWriter Overview | Members

System.Xml.XmlWriter.WriteAttributes Method

Writes the attributes found at the current position of a System.Xml.XmlReader. [Edit]

public virtual void WriteAttributes (XmlReader reader, bool defattr)

Parameters

reader
A System.Xml.XmlReader from which to copy the attributes. [Edit]
defattr
A bool where true specifies to copy the default attributes from reader; otherwise, false. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionreader is null. [Edit]
InvalidOperationExceptionThe XmlWriter.WriteState is WriteState.Closed. [Edit]
System.Xml.XmlExceptionreader is not positioned on a node of System.Xml.XmlNodeTypeAttribute, Element, or XmlDeclaration. [Edit]

Remarks

Operation
If the reader is positioned on an Element or XmlDeclaration node, this method writes all the contained attributes. If the reader is positioned on an Attribute node, this method writes the current attribute, then the rest of the attributes until the closing tag is reached. If the reader is positioned on any other node type, this method throws an exception.

This method positions the reader by calling its XmlReader.MoveToFirstAttribute and XmlReader.MoveToNextAttribute methods, and retrieves the value of the attributes by calling the XmlReader.ReadAttributeValue method of the reader.

Note to Inheritors
Override this method to remove any content that would invalidate the document.

Usage
Use this method to write all the attributes found at the current position.

[Edit]

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0