FDK - change level highest element (NoName) to get a new book of FM valid

Hello world

Using the FDK I saved a DITAMAP (referring to several files of concept) as a book with FM components, and the resulting book is not valid with the highest level of NoName element.

If I select the NoName element in view of structure of FrameMaker, then concept within the catalogue of the item and click the button change my book is now valid after an update of the book.

Is there a way using the FDK to achieve a valid book after the save operation?

Using the FDK I'm outlining a way to select all the items in the book, all packaging in a part of the concept, and then selecting the item NoName and unpacking. For me, this option feels like I correct structure subsequently was not defining the structure of the recorded book.

The newly created file book already has concept element definitions without importing it.

This would be a case of some sort by specifying a template to use when recording?

If I can give you more details please do not hesitate to ask.

Any input at all would be much appreciated.

Hi Joey,

Getting around in tree structure with code FDK is tricky business. It is difficult to get your head around a F_ElementRangeT structure and what really mean members. Ten years to do this and I still barely get it

So, at some point I hunkered down and made a lot of experiences, then built a function that manages the determinations range element for me, based on any place that I could think of that I might want to place an insertion point. I rely on that now very strongly and don't think much on the beaches of the item more. He has worked for a long time so I don't mess with it, just call it if necessary. I send an existing item ID, and then a constant that specifies where I'm looking to go from this element.

I pasted this function below, called ws_SetElementRange(). I guess that this name is not if great because it isn't really anything... it simply defines a structure of range item for you according to a reference that is passed. Then, you can use this reference to set the insertion point to with the FP_ElementSelection property, if you wanted to. I've included an example of another function that does just that, called ws_SetInsertionPoint(). At that time, I expect that my code struck these two functions, a billion times or so, because as I said, I look at them the strongly.

Note that there is a call to a function ws_GetElementTag() in there that will not solve for you. You will need to replace it with another method of obtaining the tag of the element. The tag is important to determine if the reference item is a text node or not, because those that cause different contingencies.

In addition, I see here some old notations that I could not use it today, but I think that everything is valid C. You may want to modernize the way in which the various members of the structure are referenced, but probably should not if you do not want.

I hope this can be useful.

Russ

#define ws_BEFORE_ELEMENT 1

#define ws_AFTER_ELEMENT 2

#define ws_BEGINNING_OF_BRANCH 3

#define ws_END_OF_BRANCH 4

#define ws_SELECT_ELEMENT 5

#define ws_SELECT_CONTENTS 6

UIntT ws_SetElementRange (F_ObjHandleT docId,

F_ObjHandleT elemId,

IntT location,

F_ElementRangeT * turning it over)

{

Return UIntT = True;

F_ObjHandleT tempElemId;

StringT elementTag;

TextRange F_TextRangeT;

If (! docId |! elemId) return False;

elementTag = ws_GetElementTag (docId, elemId, False);

If it is a text node, convert us 'start of the branch.

'before the element"and the same thing in 'end of branch',

respectively. They are functionally the same things and

the before/after the routines that happened to work properly. The

others have no text nodes, I don't know why but it

really doesn't matter.

If (Sie (elementTag))

{

if(location == ws_BEGINNING_OF_BRANCH)

location = ws_BEFORE_ELEMENT;

Another yew (rental is ws_END_OF_BRANCH)

location = ws_AFTER_ELEMENT;

}

Switch (rental)

{

case ws_BEGINNING_OF_BRANCH:

(* turning it over).beg.parentId = (* returning).end.parentId = elemId.

(* turning it over).beg.childId = (* returning) =.end.childId

F_ApiGetId (docId, elemId, FP_FirstChildElement);

If (!) (* Returning) ().beg.childId)

(* turning it over).beg.childId = (* returning).end.childId = 0;

(* turning it over).beg.offset = (* returning).end.offset = 0;

break;

case ws_END_OF_BRANCH:

(* turning it over).beg.parentId = (* returning).end.parentId = elemId.

(* turning it over).end.childId = (* returning).beg.childId = 0;

If the element has no children, we must define the

shifts up.  This will put us at the end of everything

text which may exist.

tempElemId = F_ApiGetId (docId, elemId, FP_FirstChildElement);

If (tempElemId)

(* turning it over).beg.offset = (* returning).end.offset = 0;

on the other

(* turning it over).beg.offset = (* returning).end.offset = FV_OBJ_END_OFFSET;

break;

case ws_BEFORE_ELEMENT:

We can get before the HLE.

tempElemId = F_ApiGetId (docId, elemId, FP_ParentElement);

If (tempElemId)

{

(* turning it over).beg.parentId = (* returning) =.end.parentId

F_ApiGetId (docId, elemId, FP_ParentElement);

(* turning it over).beg.childId = (* returning).end.childId = elemId.

(* turning it over).beg.offset = (* returning).end.offset = 0;

}

another return = False;

break;

case ws_AFTER_ELEMENT:

We can get after the HLE.

tempElemId = F_ApiGetId (docId, elemId, FP_ParentElement);

If (tempElemId)

{

(* turning it over).beg.parentId = (* returning) =.end.parentId

F_ApiGetId (docId, elemId, FP_ParentElement);

(* turning it over).beg.childId = (* returning) =.end.childId

F_ApiGetId (docId, elemId, FP_NextSiblingElement);

If (!) (() * Back).beg.childId) (* returning).beg.childId = (* returning).end.childId = 0;

(* turning it over).beg.offset = (* returning).end.offset = 0;

}

another return = False;

break;

case ws_SELECT_ELEMENT:

If it is a text node, we simply retrieve the element

text vary and convert it. It's the same for the selection

the element or the content, because the element's content

If (Sie (elementTag))

{

textRange = F_ApiGetTextRange (docId, elemId, FP_TextRange);

(* turning it over) .beg = F_ApiTextLocToElementLoc (docId, & textRange.beg);

(* turning it over) .end = F_ApiTextLocToElementLoc (docId, & textRange.end);

}

on the other

{

(* turning it over).beg.parentId = (* returning) =.end.parentId

F_ApiGetId (docId, elemId, FP_ParentElement);

(* turning it over).beg.childId = elemId.

(* turning it over).end.childId = F_ApiGetId (docId, elemId, FP_NextSiblingElement);

If (!) (() * Back).end.childId) (* returning).end.childId = 0;

(* turning it over).beg.offset = (* returning).end.offset = 0;

}

break;

case ws_SELECT_CONTENTS:

If it is a text node, we simply retrieve the element

text vary and convert it. It's the same for the selection

the element or the content, because the element's content

If (Sie (elementTag))

{

textRange = F_ApiGetTextRange (docId, elemId, FP_TextRange);

(* turning it over) .beg = F_ApiTextLocToElementLoc (docId, & textRange.beg);

(* turning it over) .end = F_ApiTextLocToElementLoc (docId, & textRange.end);

}

on the other

{

The end offset depends on whether the element has children

tempElemId = F_ApiGetId (docId, elemId, FP_FirstChildElement);

(* turning it over).beg.parentId = (* returning).end.parentId = elemId.

If (tempElemId)

(* turning it over).beg.childId = tempElemId;

other (* returning).beg.childId = 0;

(* turning it over).end.childId = 0;

(* turning it over).beg.offset = 0;

If (tempElemId)

(* turning it over).end.offset = 0;

other (* returning).end.offset = FV_OBJ_END_OFFSET;

}

break;

}

DS(&elementTag);

return return;

}

UIntT ws_SetInsertionPoint (F_ObjHandleT docId,

F_ObjHandleT elemId,

IntT location)

{

Return UIntT = True;

F_ElementRangeT er.

If (! docId |! elemId) return False;

Return = ws_SetElementRange (docId, elemId, localization, &er);)

if(returnVal == true)

F_ApiSetElementRange (FV_SessionId, docId, FP_ElementSelection, &er);)

return return;

}

Tags: Adobe FrameMaker

Similar Questions

Maybe you are looking for