XmlWriter.WriteAttributeString Method (String, String, String, String)
When overridden in a derived class, writes out the attribute with the specified prefix, local name, namespace URI, and value.
Assembly: System.Xml (in System.Xml.dll)
member WriteAttributeString : prefix:string * localName:string * ns:string * value:string -> unit
The state of writer is not WriteState.Element or writer is closed.
The xml:space or xml:lang attribute value is invalid.
The localName or ns is a null reference (Nothing in Visual Basic).
An XmlWriter method was called before a previous asynchronous operation finished. In this case, InvalidOperationException is thrown with the message “An asynchronous operation is already in progress.”
This method writes out the attribute with a user defined namespace prefix and associates it with the given namespace. If the prefix is "xmlns" then this method also treats this as a namespace declaration and associates the declared prefix with the namespace URI provided in the given attribute value. In this case the ns argument can be a null reference (Nothing in Visual Basic).
WriteAttributeString does the following:
If the attribute value includes double or single quotes, they are replaced with " and ' respectively.
If writing an xml:space attribute, the writer verifies the attribute value is valid. (Valid values are preserve or default.)
If writing an xml:lang attribute, the writer does not verify that the attribute value is valid according to the W3C XML 1.0 recommendation.
For the asynchronous version of this method, see WriteAttributeStringAsync.
.NET FrameworkSupported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
Portable Class LibrarySupported in: Portable Class Library
.NET for Windows Store appsSupported in: Windows 8
.NET for Windows Phone appsSupported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.