public WriteStartAttribute ( System localName, System namespaceUri ) : void | ||
localName | System | |
namespaceUri | System | |
return | void |
string localName = "id"; string nsURI= "http://www.example.com"; XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(Console.Out); writer.WriteStartAttribute(localName, nsURI); writer.WriteString("100"); writer.WriteEndAttribute();
string localName = "name"; string nsURI= ""; XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(Console.Out); writer.WriteStartAttribute(localName, nsURI); writer.WriteString("John"); writer.WriteEndAttribute();In this example, we are creating an attribute named "name" without a namespace. The rest of the code works the same as the previous example. The System.Xml assembly provides the XmlDictionaryWriter class.
public WriteStartAttribute ( System localName, System namespaceUri ) : void | ||
localName | System | |
namespaceUri | System | |
return | void |