NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

XmlWriter.WriteStartAttribute

Writes the start of an attribute.

[Visual Basic]
MustOverride Public Sub WriteStartAttribute( _
   ByVal name As String, _
   ByVal ns As String _
)
[C#]
public abstract void WriteStartAttribute(
   string name,
   string ns
);
[C++]
public: virtual void WriteStartAttribute(
   String* name,
   String* ns
) = 0;
[JScript]
public abstract function WriteStartAttribute(
   name : String,
   ns : String
);

Parameters

name
Name of the attribute.
ns
[To be supplied.]

Exceptions

Exception Type Condition
ArgumentException The attribute is named "xmlns:xml" and Namespaces is true. This is invalid according to the namespace spec.

Remarks

This is a more advanced version of WriteAttribute that allows you to write an attribute value using multiple write methods, such as WriteString, WriteChar, WriteInt, and so on. For example:

writer.WriteStartElement("item");
writer.WriteStartAttribute("ids",null);
    writer.WriteInt(12);
    writer.WriteInt(25);
    writer.WriteInt(17);
writer.WriteEndAttribute();
writer.WriteInt(122);
writer.WriteEndElement();

which produces the following output:

<item id="12 25 17">122</item>

Notice that the WriteEndAttribute makes the last call to WriteInt(122) generate element content instead of attribute content.

See Also

XmlWriter Class | XmlWriter Members | System.NewXml Namespace