To enable import/export of data in XML files through the Data Exchange Framework or through an XMLport, you can use the files’s XML schema to define which data elements you want to exchange with Microsoft Dynamics NAV. You perform this work in the XML Schema Viewer window by loading the XML schema file, selecting the relevant data elements, and then initializing either a data exchange definition or an XMLport.
When you have defined which data elements to include based on the XML schema, you can use the Generate XMLport action to create the XMLport object for import into the Object Designer.
Alternatively, you can use the Generate Data Exchange Definition action to initialize a data exchange definition based on the selected data elements, which you then complete in the Data Exchange Framework. This creates a record in the Data Exchange Definition window where you continue by defining which elements in the file map to which fields in Microsoft Dynamics NAV. For more information, see How to: Set Up Data Exchange Definitions.
This topic contains the following procedures:
-
To load an XML schema file
-
To select or clear nodes in an XML schema
-
To generate a data exchange definition that is based on an XML schema
-
To generate an XMLport for the file that is based on an XML schema
-
To import an XMLport into the Object Designer
To load an XML schema file
Make sure that the relevant XML schema file is available. The file extension is .xsd.
In the Search box, enter XML Schemas, and then choose the related link.
On the Home tab, in the New group, choose New.
Fill the fields as described in the following table.
Field Description Code
Specify a code to identify the XML schema.
Description
Specify a description of the XML schema.
The Target Namespace field specifies any namespace in the XML schema file that has been loaded for the line.
On the Home tab, in the Process group, choose Load Schema, and then select the XML schema file.
When the file is loaded, the rest of the fields on the line are filled with information from the file, and the Schema is Loaded check box is selected.
Note The tree of the loaded XML schema is collapsed by default. You expand each node by choosing the + button on the node. To expand all nodes, choose Expand All on the ribbon.
To select or clear nodes in an XML schema
In the Search box, enter XML Schema Viewer, and then choose the related link.
Fill the fields on the header as described in the following table.
Field Description XML Schema Code
Specify the XML schema file that you loaded in step 5 in the “To load an XML schema file” section.
New XMLport No.
Specify the number of the XMLport that is created from this XML schema when you choose the Generate XMLport action.
The lines are now filled with nodes representing all elements in the XML schema. Nodes for elements that are mandatory according to the XML schema are selected by default.
On the first line, in the Node Name column, expand the Document node, and then gradually expand underlying nodes that you want to review.
Alternatively, right-click on a node and then choose Expand All.
On the Home tab, in the View group, choose either of the following actions to change which nodes are displayed.
Action Description Show All
All nodes are shown.
Hide Non-Mandatory
Only nodes representing elements that are required according to the XML schema are shown. These nodes are typically indicated by a 1 in the MinOccurs field.
Choose Show All to reverse the view.
Hide Non-Selected
Only nodes where the Selected check box is selected are shown.
Choose Show All to reverse the view.
On the Home tab, in the Manage group, choose Edit.
In the Selected check box, specify for each node if you want the element to be supported in the data exchange definition for the related SEPA bank file.
Note When you select a mandatory child node, all parent nodes above it are also selected. Choose the Select All Mandatory Elements action to reselect all nodes that represent elements that are mandatory according to the XML schema.
Choose the Deselect All action to clear all selections.
The Choice field specifies that the node has two or more sibling nodes that function as options.
To generate a data exchange definition that is based on an XML schema
In the Search box, enter XML Schemas, and then choose the related link.
Select the relevant XML schema, and then on the on the Home tab, in the Process group, choose Open XML Schema Viewer.
Make sure the relevant nodes are selected. For more information, see the “To select or clear nodes in an XML schema” section.
In the XML Schema Viewer window, on the Home tab, in the Process group, choose Generate Data Exchange Definition.
A data exchange definition is created in the Data Exchange Definition window, which you can complete by specifying which elements in the file map to which fields in Microsoft Dynamics NAV. For more information, see How to: Set Up Data Exchange Definitions.
Note |
---|
You can also use the Get File Structure function from the Data Exchange Definition window, which uses the functionality of the XML Schema Viewer window to prefill the Column Definitions TastTab. For more information, see Get File Structure. |
To generate an XMLport that is based on an XML schema
In the Search box, enter XML Schemas, and then choose the related link.
Select the relevant XML schema, and then on the on the Home tab, in the Process group, choose Open XML Schema Viewer.
In the New XMLport No. field, specify the number that the new XMLport object will be given when it is generated.
Make sure the relevant nodes are selected. For more information, see the “To select or clear nodes in an XML schema” section.
On the Home tab, in the Process group, choose Generate XMLport, and then save the object as a .txt file in an appropriate location.
To import an XMLport into the Object Designer
Open Microsoft Dynamics NAV Development Environment.
In the Object Designer, choose XMLport.
Choose File, and then choose Import.
Select the XMLport object that you saved as a .txt file in the “To generate an XMLport that is based on an XML schema“ section, and then choose Open.
Tip |
---|
For more information about how to work with fields and columns, see Working with Microsoft Dynamics NAV. For more information about how to find specific pages, see Search. |