Altova MapForce 2025 Basic Edition

Relative and Absolute Paths

Home Prev Top Next

This topic explains how to use absolute and relative paths of the files referenced by your component. An absolute path shows the full location of a file, starting with the root directory (see Example: XML Component below). A relative path shows the file location which is relative to the current working directory: e.g., Books.xml.

 

In the Component Settings dialog box (see example below), you can specify absolute or relative paths for various files which can be referenced by the component. The list of these files is given below:

 

Input files from which MapForce reads data;

Output files to which MapForce writes data;

Schema files, which are applicable to components with a schema;

Structural files, which are used as input or output parameters of user-defined functions and variables;

StyleVision Power Stylesheet (*.sps) files, which are used to format data for outputs such as PDF, HTML and Word;

Database files in the case of database components (Professional and Enterprise editions).

 

Copy-paste and relative paths

When you copy a component from a mapping and paste it into another mapping, MapForce checks whether the relative paths of schema files can be resolved against the folder of the destination mapping. If the paths cannot be resolved, you will be prompted to make the relative paths absolute.

 

Broken paths

When you add or change a file reference in a mapping, and the path cannot be resolved, MapForce displays a warning message. Broken path references may happen in the following cases:

 

You use relative paths and then move the mapping file to a new directory without moving the schema and instance files.

You use absolute paths to files in the same directory as the mapping file and then move the directory to another location.

 

When one of these scenarios happens, MapForce highlights the component in red. The solution is to double-click the red component header and update any broken path references in the Component Settings dialog box. See also Change Component Settings.

 

Example: XML component

The example below shows how file paths are used in an XML component. If you want to save all the mapping-related files relative to the mapping file (.mfd), check the box Save all file paths relative to MFD file at the bottom of the Component Settings dialog box. This is the default and recommended option that affects all the files referenced by the component (shown in the red frame in the image below). If you have not saved your mapping yet, you will see absolute paths to the schema and/or instance files in the Component Settings dialog box. To see relative paths in the Component Settings dialog box, take the following steps:

 

1.Create a new mapping and add a structural component: e.g., an XML file with an XML schema assigned to it.

2.Double-click the header of the component to open the Component Settings dialog box.

3.Check the box Save all file paths relative to MFD file at the bottom of the Component Settings dialog box.

4.Save your mapping.

5.You can now open Component Settings again to check the relative paths in the relevant text fields.

 

Note:Paths that reference a non-local drive or use a URL will not be made relative.
MF_MapFund_Components_Paths_RelatAbs1

When the check box Save all file paths relative to MFD file is selected, MapForce will keep track of the files referenced by the component even when you save the mapping to a new folder. If all the files are in the same directory as the mapping, the path references will not be broken when you move the entire directory to a new location on the disk.

 

The setting Save all file paths relative to MFD file applies to the following files:

 

Structural files used by complex input or output parameters of user-defined functions and variables of complex type;

Input or output flat files (Professional and Enterprise editions);

Schema files referenced by database components which support XML fields (Professional and Enterprise editions);

Database files (Professional and Enterprise editions);

Input or output XBRL, FlexText, EDI, Excel 2007+, JSON files (Enterprise Edition only).

 

Example: Database component (Professional and Enterprise editions)

When you add a database file such as Microsoft Access or SQLite to the mapping, you can enter a relative path instead of an absolute one in the Select a Database dialog box (see screenshot below). Before entering relative file paths, make sure to save the .mfd file first. If you want to change the path of a database component which is already in the mapping, click Change in the Component Settings dialog box.

MF_MapFund_Components_Paths_RelatAbs2
Note:When you generate program code, compile MapForce Server execution files (.mfx), or deploy the mapping to FlowForce Server, a relative path will be converted to an absolute path if you select the check box Make paths absolute in generated code in the mapping settings. To find out more, see About Paths in Generated Code.

 

© 2018-2024 Altova GmbH