Skip to main content
Inspiring
April 19, 2022
Answered

Create new structure document using FDK

  • April 19, 2022
  • 1 reply
  • 756 views

Hi,

I am working on a client and in some parts of it, I want to create a new structured document using the structured application definition (I have DTD, EDD, read & write rules, and a template file.) Using the Adobe FDK Programmer's Reference I came up with the code below:

F_PropValsT params = F_ApiGetNewXMLDefaultParams();
F_PropValsT *retParams = NULL;
for (UIntT i = 0; i < params.len; i++)
{
  params.val[i].propVal.u.sval = F_StrCopyString("S1000D_description_401");
}
F_ApiNewXML(&params, &retParams);
F_ApiDeallocatePropVals(&params);
F_ApiDeallocatePropVals(retParams);

My problem is that the code creates a new document but has problems creating the structure (I even checked this code with Frame Maker defined S1000D descriptive schema, as it is seen in the code, but I had no chance.) I get an error message saying "Data Module Structure is not correct for ToC generation", and it creates an empty document without any structure.

Digging a little more into the FDK reference document, I found F_ApiCallClient("Structure Generator") command. I was not sure if it could solve my problem or not, but I thought of giving it a try. However, I got stuck. This command needs the ID of the rule table document, which I am not sure what it is? 

So, to list my problems:

1) How can I create a structured document using FDK? What am I missing in my code?

2) Does "Structure Generator" related to my issue? If yes, what is the rule table document?

I would appreciate any kind of help or suggestions since I am working on this problem for weeks without any bit of improvement.

Thanks,

Sanam

This topic has been closed for replies.
Correct answer Russ Ward

Unfortunately, the document opens without any automatically built structure. In my code, I got the root element in the structure view window, but when I used F_ApiOpen() I didn't even get the root element and I have to add it manually from the element catalog.


The document will open according to how it was last saved. So if you want the root element to be there, save a template with that root element inserted and then open it with F_ApiOpen().

 

The Structure Generator is definitely not what you want. It is not applicable to this use case. Its function is to add structure to currently unstructured content. Not to build new structure where no content currently exists.

 

Russ

1 reply

frameexpert
Community Expert
Community Expert
April 19, 2022

I work more with ExtendScript than the FDK, but if you already have a template, you can use the FDK to open a new, untitled copy of the template, which would have all of your elements and attributes available in it.

Legend
April 19, 2022

Yes, my thoughts exactly. Very easy to just save a template somewhere and open it with F_ApiOpen(). You can open it directly and do a "save as" or open a copy. Both are effectively the same. I've never used the sample code that you presented, but I can't help but think that it is the more difficult approach.

 

Russ

sanam.dehAuthor
Inspiring
April 19, 2022

Unfortunately, the document opens without any automatically built structure. In my code, I got the root element in the structure view window, but when I used F_ApiOpen() I didn't even get the root element and I have to add it manually from the element catalog.