• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Create new structure document using FDK

Explorer ,
Apr 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

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

TOPICS
Error , Scripting , Structured , Technical Communication Suite , XML author

Views

212

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

correct answers 1 Correct answer

Mentor , Apr 19, 2022 Apr 19, 2022

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

Votes

Translate

Translate
Community Expert ,
Apr 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

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.

Votes

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
community guidelines
Mentor ,
Apr 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Explorer ,
Apr 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

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.

Votes

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
community guidelines
Mentor ,
Apr 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Explorer ,
Apr 20, 2022 Apr 20, 2022

Copy link to clipboard

Copied

Thank you Russ,

I will try as you suggested.

 

Sanam

Votes

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
community guidelines
Explorer ,
Apr 20, 2022 Apr 20, 2022

Copy link to clipboard

Copied

LATEST

Well, I got what I wanted at last. I opened the template file imported from the EDD file and manually made the element structure. Saved the template as a new template, and from my client, I opened my newly created template and it worked as I wanted.

Thank you all for your suggestions.

Votes

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