SetDefaultValue
Sets the value of current node if has empty value.
| myXml.SetDefaultValue(value: any):void
|
Sets the all node values on specified xpath if has empty value.
| myXml.SetDefaultValue(xpath: string, value: any):void
|
Parameters
any value
Value to update
string xpath
XPath of node to set. If not specified current node is used.
Example
| $Xml.SelectSingle('Customer/Name').SetDefaultValue('Unknown Name');
|
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');
});
|
| $Xml.SetDefaultvalue('Date', DateTimeOffset.now );
|
See Also