Skip to content

Element

Adds a new element with the specified name and value.

1
myXmlWriter.Element(name: string, value: ( string | number | boolean | DateTimeOffset )):XmlWriter

Parameters

string name
    name of element

( string | number | boolean | DateTimeOffset ) value
    value of element

Remarks

This method creates a new element with the specified name and value and returns the current writer instance.
value is encoded with XML encoding rules.

Example

1
2
3
4
var writer = $Xml.Create();
writer.Element('Customer', 'Doe');
var xml = writer.ToXml();
// xml: <Customer>Doe</Customer>

See Also