Define nodes and their properties

Completed

Nodes form the structure of XMLports and the structure of the XML document or text file that is to be imported from or exported to. Each node has several important properties that can be accessed directly from Visual Studio Code. The following sections describe each node and its properties.

XMLName

XMLName is used to specify the XML node name of the XML element or attribute. Node names must be entered in the order in which they are presented in the XML document. Parent elements must come before their child elements. Indent the node names of child elements under their parent elements by using one indentation for each level. List attributes under the elements that they define and indent them to the child level.

TextElement, TableElement, and FieldAttribute

The TextElement, TableElement, and FieldAttribute nodes are used to specify whether the name in the Node Name source type represents data of the Element or Attribute types. This source type is used together with the Data Source type to specify the data source for the data structure.

Additional information about Data Source type options:

  • TextElement - Select this option when the XML data can't be mapped directly to the database or when the external file requires the information that the database doesn't require or contain. The Text field value is put into a text variable that is specified in the VariableName property. If you don't specify the XMLName property, then the node name is used by default. You can change the variable type into a big text type by setting the TextType property to BigText.

  • TableElement - Select this option to indicate that a node maps to a table. Similar to the Text option, you can specify a variable name for the table that also functions like a global record variable.

  • FieldAttribute - Select this option to indicate that a node maps to a field in the table. For this selection to be valid, you must declare a table as the parent of the field. Failure to complete this action prevents the XMLport object from compiling.

AutoSave, AutoUpdate, and AutoReplace

The AutoSave, AutoUpdate, and AutoReplace node properties describe the XMLport node that defines the XMLport's structure. Depending on the node type, different properties are available.

When the Node type is set to Table, three more properties will specify the behavior of the XMLport during import operations:

  • AutoSave - Specifies whether imported records are automatically written to the table.

  • AutoUpdate - Specifies whether a record in the database that has the same primary key as a record in the import file is updated with values from the imported record. Values of database fields that are not present in the import file will not be modified by the XMLport.

  • AutoReplace - Sets whether imported records automatically replace existing records with the same primary key. Values of database fields that are not present in the import file will be reset to their initial value according to their InitValue property.

These three properties determine how records that are read from the external file are handled. They are also used to resolve the conflict that arises when a record that is read from the external file during import has the same primary key as a record that already exists in the database table.