Writes out the specified start tag and associates it with the given namespace.
[Visual Basic] Overrides Public Sub WriteStartElement( _ ByVal name As String, _ ByVal ns As String _ ) [C#] public override void WriteStartElement( string name, string ns ); [C++] public: override void WriteStartElement( String* name, String* ns ); [JScript] public override function WriteStartElement( name : String, ns : String );
Exception Type | Condition |
---|---|
InvalidOperationException | If writer is closed. |
After calling this method you can either write attributes, or you can go directly to content (WriteComment, WriteString, or WriteStartElement for child elements). You must close this element with WriteEndElement at which time a full end tag is written out. For example:
[C#]
writer.WriteStartElement("foo",null"); writer.WriteEndElement();
will generate the following output:
[C#]
<foo></foo>
If you want to write an empty element with the "/>" syntax, then use WriteEmptyElement .
XmlTextWriter Class | XmlTextWriter Members | System.NewXml Namespace