Hello Scripters,
I have a recursive function that touches every element in a structured FrameMaker file. I am trying to find out how to get text nodes as I process the elements.
#target framemaker
var doc = app.ActiveDoc;
var element = doc.MainFlowInDoc.HighestLevelElement;
processElements (element);
function processElements (element) {
if (element.ElementDef.ObjectValid()) { $.writeln (element.ElementDef.Name); } else { // I thought I could get text nodes here, but it never gets here. } var element2 = element.FirstChildElement; while(element2.ObjectValid()) { processElements (element2); element2 = element2.NextSiblingElement; }
}
I expected that I would get the text nodes on line 14, but it the else statement never gets there. In FrameScript, if an element has no ElementDef, then it is a text node. I am not sure about the FDK. Any ideas how I can pick up the text nodes in a function like this? Thanks.
-Rick