XmlWriter::Create Method (String^)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates a new XmlWriter instance using the specified filename.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public:
static XmlWriter^ Create(
	String^ outputFileName
)

Parameters

outputFileName
Type: System::String^

The file to which you want to write. The XmlWriter creates a file at the specified path and writes to it in XML 1.0 text syntax. The outputFileName must be a file system path.

Return Value

Type: System.Xml::XmlWriter^

An XmlWriter object.

Exception Condition
ArgumentNullException

The url value is null.

When you use this overload, an XmlWriterSettings object with default settings is used to create the XML writer.

Setting

Default

CheckCharacters

true

CloseOutput

false

ConformanceLevel

ConformanceLevel::Document

Encoding

Encoding::UTF8

Indent

false

IndentChars

Two spaces

NamespaceHandling

Default (no removal)

NewLineChars

\r\n (carriage return, new line)

NewLineHandling

NewLineHandling::Replace

NewLineOnAttributes

false

OmitXmlDeclaration

false

OutputMethod

XmlOutputMethod::Xml

WriteEndDocumentOnClose

true

If you want to specify the features to support on the created XML writer, use an overload that takes an XmlWriterSettings object as one of its arguments, and pass in a XmlWriterSettings object with your custom settings.

The following example creates an XmlWriter object and writes a book node.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: