Highlighted

FDK C/C++ - Frame Book conversion to XML (FrameMaker 12)

Community Beginner ,
Mar 14, 2018

Copy link to clipboard

Copied

Greetings.

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.         

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

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 -->

]>

<?Fm Book?><manual>&bkc1;

<toc>&bkc2;</toc>&bkc3;&bkc4;&bkc5;&bkc6;&bkc7;&bkc8;&bkc9;&bkc10;&bkc11;</manual>

TOPICS
Scripting

Views

199

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

FDK C/C++ - Frame Book conversion to XML (FrameMaker 12)

Community Beginner ,
Mar 14, 2018

Copy link to clipboard

Copied

Greetings.

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.         

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

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 -->

]>

<?Fm Book?><manual>&bkc1;

<toc>&bkc2;</toc>&bkc3;&bkc4;&bkc5;&bkc6;&bkc7;&bkc8;&bkc9;&bkc10;&bkc11;</manual>

TOPICS
Scripting

Views

200

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 14, 2018 0
Adobe Community Professional ,
Mar 14, 2018

Copy link to clipboard

Copied

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 -->

]>

<?Fm Book?><manual>&bkc1;

<toc>&bkc2;</toc>&bkc3;&bkc4;&bkc5;&bkc6;&bkc7;&bkc8;&bkc9;&bkc10;&bkc11;</manual>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 14, 2018 0
Community Beginner ,
Mar 14, 2018

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 14, 2018 0
Enthusiast ,
Mar 14, 2018

Copy link to clipboard

Copied

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...

  1. Export the entire book as an XML instance and then use an XSLT transformation to split the content into separate XML files. I do this for one of my clients and it works very well.
  2. Take the route you mention iterate through each book component and save as XML.

I would take option 1, but then I like XSLT...

Ian

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 14, 2018 0