Automatically link an application to any XML file in FrameMaker

Do you know we can associate an application directly with an XML file?
This will save our time through the lengthy process of first opening a structured application file, reading the definitions and selecting the application from the list while XML file opens and closes. Besides, we face other difficulties when we require dealing with multiple application files. Suppose we are closing an XML file; we need to make sure that the application with which the XML file is being saved is indeed the app from the correct structapps file. Saving with incorrect application may sometime be catastrophic. This will lead user to redundantly keep performing the task of reading structapps file as I discussed.

To link a structured application with an XML file, all we need to do is to write in a PI (processing instruction) statement in the XML file. This PI will contain the path of structapps file and name of the app within it. The statement can be written in one of the following three forms:

<?Fmwd AppLocation "structapps_path" AppName "application"?>

<?Fmwd AppLocation "structapps_path"?>

<?Fmwd AppName "application"?>

If AppLocation is provided, FrameMaker will silently read file from structapps_path while we open and save the XML file else Frame will use previous read structapps file. If AppName is specified, the application will automatically be associated with the XML. If AppName is not there, the file at structapps_path will still be read; the only difference will be that the user will be prompted to choose from the list of applications by himself. If application is invalid i.e. not present in list of applications, the XML file will be opened with No Application.

Note that the PI has to appear before the root element of the XML file. Here I am showing an example XML code with a PI instruction:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="simple_table.css" type="text/css"?>
<?Fmwd AppLocation "simple_table_sa.fm" AppName "simple_table"?>

<?Fm TrackChange Off PreviewState PREVIEW_OFF_TRACK_CHANGE?>

<myBook Author = "Klark"
xsi:noNamespaceSchemaLocation = "simple_table.xsd"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance">
..

Since DITA files are also XML based, Frame will process this PI in DITA files too. The structapps_path can be either an absolute path or a relative path as shown in code above. Relative paths will be relativized with respect to the XML file location. Further, structapps_path can also point to a file at HTTP location.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s