DataTable.ImportFromXml
Overview¶
DataTable DataTable.ImportFromXml ( options )
Arguments¶
object options Specifies the import options and may contain one or more following properties:
String xpath Specifies the XPath to be imported.
XmlNode node Specifies the context xml node. Optional, if not specified "$Xml" is used.
Function__ map__ Specifies the mapper function to be executed for each row. Optional.
String columnsXPath Specifies the additional column mapping xpath. Optional. See remarks.
Remarks¶
ColumnsXPath is used to specify additional secondary mapping path by XPath argument.
This method is not call save method after executed. If you want to save changes you need to explicitly call Save method or use $Database.ImportFromXml
Examples¶
Common use for importing data
var table = $Database.Get({ Parameters : { TargetSchema: 'HR', TargetTable: 'Groups' } }); table.ImportFromXml({ XPath : 'Groups/Group' }); table.Save();
Using map function
var table = $Database.Get({ Parameters : { TargetSchema: 'HR', TargetTable: 'Groups' } }); table.ImportFromXml({ XPath : 'Groups/Group', map : function(node) { this.Id = node.Evaluate('../Id'); } }); table.Save();