Skip to content

XmlNode.SetDefaultValue

Overview

void XmlNode.SetDefaultValue ( [ xpath ], value )
Updates all node values on specified xpath or current node if has empty value.

Arguments

String xpath XPath of node to set. If not specified current node is used.

object value Value to update

Remarks

Examples

Update current node value

$Xml.SelectAll('//Customer', function() {
  this.SetDefaultValue('Name','Unknown Name');
});

Updates with an xpath

$Xml.SetDefaultValue('//Customer/Id','1');

Updates current node value

var xml = $Xml.SelectSingle('//Customer/Id', function() {
  this.SetDefaultValue('1');
});

Update form submit date if its empty

$Xml.SetDefaultvalue('Date', DateTimeOffset.now );

See Also