Database Setup Wizard Options |
The Database Setup wizard offers functionality and options that you can use to define how the XML should be interpreted when it is converted to a database. The wizard includes the following pages.
After you select an XML file, you see a preview in the File Preview area of the file that you connected to (on the Contents tab) and of the database table that results (on the Fields tab).
Use this page to provide an external schema file or to specify that the wizard should infer the schema from the XML file that you provided.
If the XML contains internal schema references that are inaccessible or not valid, you receive an error message. You must resolve any schema issues before you can continue.
The following options are available:
Automatically detect schema from XML file: Specifies that the wizard infers the schema from the XML file that you provided. Use this option when you do not have a separate schema file.
|
When automatic schema detection is used, the data type for the fields always defaults to “text.” You can change the data types on the Fields property page of the Database Setup dialog. |
Specify schema or document type definition file(s): Provides options to upload an external schema file. Click Add to browse for the file.
In the Select all elements of a single type area, select the element that you want to use as the master element. This element forms the basis of the database records.
When you select the master element, a preview of the resulting database table is displayed on the Fields tab. A database record (one row in the table) is created for each occurrence of the selected master element in the XML file.
On this page, you can select only one master element. To select multiple master elements or to select only some elements based on other criteria, click to select the Select elements using an advanced condition or XPath expression check box, and then click Next to open the Advanced Record Element Selection page.
This page provides advanced options for selecting master elements. The following options are available:
Select all elements of type: Specifies that all the elements of the selected type are used as master elements.
Select all nodes of type: Specifies that all the nodes (elements) of the selected type that occur under the element that is selected in the Under list are used as master elements.
Select record node(s) via custom XPath: Specifies the custom XPath expression that you want to use. Advanced users who have knowledge of the XPath query language can use it to select nodes from the XML document and compute values from the XML document contents.
The following examples illustrate the different database results that you get when you select a single element as the master element or select all the elements of the same type as the master element.
Select a single element as the master element
Suppose that you are using the following XML file.
You select the <Name> node for "Angela Franklin" to be the master element. Because there are two instances of the <Name> element in the parent <Employees> node, the database includes two records and resembles the following:
Select all elements of the same type
Suppose that you are using the following XML file.
On the Advanced Record Element Selection page, you do one of the following:
Click to select Select all elements of type, and then select Name in the list.
Click to select Select all nodes of type, select Name in the list, and then select Company or Manager in the Under list.
The resulting database captures all instances of the <Name> element and generates three records, as follows:
After you select one or more master elements, you can use this page to select the elements and attributes that you want to contribute field data to your database and to specify how you want repeating elements to be handled.
The Available Nodes area displays the elements and attributes that you can select to provide field data. These can include both parent and child elements and their attributes. Click to select the check boxes for the nodes that you want.
For repeating nodes, the options that are available depend on the data type (string, numeric, date, Boolean, and so on) and include the following.
|
If you did not provide a schema file, the wizard allows for elements in your XML to repeat even if they do not repeat in your sample XML file. Therefore, these options might be available even though these nodes do not actually repeat. |
Use First: Specifies that the field value is retrieved from the first occurrence of the element.
Use Last: Specifies that the field value is retrieved from the last occurrence of the element.
Concatenate: Specifies that the field value is a concatenation of all occurrences of the element, which are separated by the specified separation character. In the Separation character(s) field, enter the separation character that you want to use, and then click Apply.
Sum: Specifies that the field value is the sum of the values of the repeating nodes.
Average: Specifies that the field value is the average of the values of the repeating nodes.
Min: Specifies that the field value is the minimum value that occurs in the repeating nodes.
Max: Specifies that the field value is the maximum value that occurs in the repeating nodes.
Multi-field: Specifies that the element can represent more than one field value. The contents of the attribute node determine which value is used for which field. Available only for elements that contain attributes.
Suppose that you are using the following XML file.
You select <owl> as the master element. The default setting for the repeating <property> element is Concatenate, which results in the following database table.
However, you want each variation of the repeating <property> element to be treated as a unique field (column) of data according to its typeid attribute. When you select the Multi-field option, the following database results.
Use Previous: Specifies that the field value is retrieved from the previous occurrence of the element or attribute relative to the master element. Available only for elements and attributes that are relative to the master element; cannot be applied to nodes that are descendants of the master element.
Suppose that you are using the following XML file.
You select <FirstName> as the master element. The default setting for the repeating <LastName> element is Concatenate, which results in the following database table.
However, you want the field value for LastName to use the previous instance of the repeating <LastName> element to populate the database instead of all the values of all the <LastName> elements. When you select the Use Previous option, the following database results.
Use Next: Specifies that the field value is retrieved from the next occurrence of the element or attribute relative to the master element. Available only for elements and attributes that are relative to the master element; cannot be applied to nodes that are descendants of the master element.
Suppose that you are using the following XML file.
You select <FirstName> as the master element. The default setting for the repeating <LastName> element is Concatenate, which results in the following database table.
However, you want the field value for LastName to use the next instance of the repeating <LastName> element to populate the database instead of all the values of all the <LastName> elements. When you select the Use Next option, the following database results.