Making XML Round Trip work in Adobe FrameMaker

* FINALIZING A DTD FOR USE WITH A FRAMEMAKER STRUCTURED APPLICATION *

This article deals with finalizing a Document Type Definition (DTD) created from your FrameMaker Element Definition Document (EDD) (StructureTools > Save As DTD).

FrameMaker applications may include several interdependent files and various application settings. You will likely have these three files as a part of your structured application: a FrameMaker structured template (your template with the element definitions imported into it), a DTD or a schema (to validate your XML), and read/write rules (to make any needed changes).
These files work together to provide you with valid structure inside FrameMaker and valid XML on export.

When you save your EDD as a DTD, FrameMaker asks you for an application name. You do not need to specify an application unless you have written an application for modifying the DTD on save. FrameMaker also asks you to specify whether your DTD is for SGML or XML. For this article, it is assumed you will save as an XML DTD, though most of these steps would apply to SGML as well.

NOTE: Be sure to validate your DTD, since FrameMaker may save your general rules as "SGML friendly" content models that do not work for XML.

Examining the DTD FrameMaker creates, you will see that for graphic elements, FrameMaker adds attributes. These attributes ensure enough data about the graphic is available as attributes in the XML. When the graphics are saved to XML, FrameMaker adds these attributes to the XML within your graphic elements. It also adds the attributes to the DTD for you.

For tables, FrameMaker also needs some attribute information to be saved, but does not at this point put the appropriate attributes into the saved DTD (as it does for the graphics).

NOTE: I do not know why FrameMaker does not add these attributes to the DTD by default, as it seems it should add them in the same way it adds the needed attributes to graphic elements....same idea, just different behavior seems to have been built in.

This is what you will likely need to add to your DTD for each of your table elements, after Frame creates the DTD:

cols CDATA #IMPLIED
colsep CDATA #IMPLIED
rowsep CDATA #IMPLIED
tabstyle CDATA #IMPLIED

NOTE: Example uses generic attribute names that will need to be changed to your own attribute names, if you use these steps for your own DTD and read/write rules files, continued below.

This handles the extra attributes needed by FrameMaker to properly handle XML tables. These attributes are used when you open your XML file in FrameMaker.

There are corresponding attributes in the read/write rules file that ensure when a table is saved to XML, the attributes are put into the XML in each table element. Then, when the XML is opened in FrameMaker again, the attributes are used to properly build the table. These are "must haves".
The "cols" attribute, for example, must be used or else when you open your XML files in FrameMaker, the tables will only be one column... and you'll get errors that you are trying to insert cell elements where they do not belong. Using the "cols" attribute allows FrameMaker to note the number of columns a table is supposed to have when you save as XML. Then, when you open the XML file in FrameMaker, the "cols" attribute turns into the columns in your table.

Within the read/write rules, you will need to ensure you have corresponding rules for handling these attributes... some of which become properties of the documents (as opposed to showing up as attributes in the structure).
Something like:

element "tgroup"
{
is fm table element;
attribute "cols" is fm property columns; attribute "colsep" is fm property column ruling; attribute "rowsep" is fm property row ruling; attribute "tabstyle" is fm property table format; }

NOTE: You are also likely to need table-related read/write rules for colspec, spanspec, etc.

Your goal is to have your template/EDD, DTD, and read/write rules files in sync. Elements and attributes names need to match, so ensure you change the above examples to use your element and attribute names.

-----

If you get hung up, you might check out the "Structure Application Developer's Guide" that installs with FrameMaker, "XML and FrameMaker"
published by Apress, or the new "XML and FrameMaker 8" coming in 2008. You might also enlist the assistance of a structured FrameMaker consulting group (such as Bright Path Solutions) to ensure your one-time setup of structure is flawless.

Feel free to email your questions or requests to kay@brightpathsolutions.com. I would be happy to answer questions and help you meet your publishing goals.