Table of Contents

Method CreateXmlDeclaration

Namespace
SharpVectors.Dom
Assembly
SharpVectors.Dom.dll

CreateXmlDeclaration(string, string, string)

Creates an XmlDeclaration node with the specified values.

public override XmlDeclaration CreateXmlDeclaration(string version, string encoding, string standalone)

Parameters

version string

The version must be "1.0".

encoding string

The value of the encoding attribute. This is the encoding that is used when you save the XmlDocument to a file or a stream; therefore, it must be set to a string supported by the Encoding class, otherwise Save(string) fails. If this is null or String.Empty, the Save method does not write an encoding attribute on the XML declaration and therefore the default encoding, UTF-8, is used.Note: If the XmlDocument is saved to either a TextWriter or an XmlTextWriter, this encoding value is discarded. Instead, the encoding of the TextWriter or the XmlTextWriter is used. This ensures that the XML written out can be read back using the correct encoding.

standalone string

The value must be either "yes" or "no". If this is null or String.Empty, the Save method does not write a standalone attribute on the XML declaration.

Returns

XmlDeclaration

The new XmlDeclaration node.

Exceptions

ArgumentException

The values of version or standalone are something other than the ones specified above.