Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Updates all node values on specified xpath or current node if has empty value.

void myXml.SetDefaultValue(value: any)

Updates all node values on specified xpath or current node if has empty value.

void myXml.SetDefaultValue(xpath: string, value: any)

Arguments

any value
Value to update
string xpath
XPath of node to set. If not specified current node is used.

Example

Update current node value

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

Example

Updates with an xpath

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

Example

Updates current node value

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

Example

Code Block
languagets
Update form submit date if its empty

Example

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

Example

Update form submit date if its empty

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