I am using FrameMaker 12 with the C/C++ FDK. I have looked into scripting the feature of converting a Frame Book to an XML. I have looked at the FDK Reference and Programmer's guide for assitance.
- What is the recommeded sequence to convert the book file to XML? My thought is as follows:
1. Open the book
2. Iterate over each compenent
i) Open each component
ii) Save each component as XML
3. Close the book
There are more questions to ask but I thought I would start a discussion and work through the solution. Thank you in advance.
Typically, you would just open the book and save the book as XML. FrameMaker will make separate xml files for each book, but all of the inter-book links, etc. will work. Then you would close the book. As an example, here is the XML from a structured book. You can see that it uses entities to refer to each component's XML file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE manual SYSTEM "file:///C:/DATA/Scripts/app/UserManual.dtd" [
<!-- Begin Document Specific Declarations -->
<!ENTITY bkc1 SYSTEM "Cover.e01">
<!ENTITY bkc2 SYSTEM "APM_ControlSystemTOC.e02">
<!ENTITY bkc3 SYSTEM "APM_CS_GeneralInformation.e03">
<!ENTITY bkc4 SYSTEM "APMDevices.e04">
<!ENTITY bkc5 SYSTEM "APM_CS_Startup.e05">
<!ENTITY bkc6 SYSTEM "APM_CS_Screens.e06">
<!ENTITY bkc7 SYSTEM "APM_CS_ProgrammableLogicController.e07">
<!ENTITY bkc8 SYSTEM "APM_CS_Alarms.e08">
<!ENTITY bkc9 SYSTEM "CustomerSpecificDocuments.e09">
<!ENTITY bkc10 SYSTEM "VendorInformation.e10">
<!ENTITY bkc11 SYSTEM "ManualsEvaluationForm.e11">
<!-- End Document Specific Declarations -->
I see the same result from both the GUI and CLI.
Now, lines 4-15, are those references added because of the validation with the DTD? My result does not contain entity references. Also, should the resulting XML have content (lines 20-21)? Even though it is XML, I was expecting a large XML to be filled in with content from the various components. Especially, the TOC file. How should one troubleshoot to get that resolved?
Hello again Mastachef,
Saving a structured FrameMaker book as XML is a normal FrameMaker function, so you can save the book as a single XML file just as you would from the UI. There wouldn't even be a need to iterate over the book file unless you want to do something specific to each Frame document first.
The result would be the same as via the UI. An XML file that references an entity file for each book component. Quite simple really. Of course you may want separate XML instances for each FM document. In that case you have at least two options depending on your preferences...
I would take option 1, but then I like XSLT...