Not sure what you mean by 'looping through all my document' and 'wraping the element text'. Attributes are normally not visible in the text content of a structured document. To get to the attributes, you select the element and search its attribute list for the values. You can also do this on the book, as that has structured content which works basically in the same way. The only real difference is that the book does not have flows, so you get to the highest level element in a different way:
In a structured FM document:
var oDoc = app.ActiveDoc;
var oRoot = oDoc.MainFlowInDoc,HighestLevelElement;
In a structured FM book:
var oDoc = app.ActiveBook;
var oRoot = oDoc.HighestLevelElement;
To get the attribute value for an attribute you can use this function:
function GetAttribute( oElement, sAttName ) {
var oaAttrs = oElement.Attributes;
var sRetVal = "";
var i = 0;
var bFound = false;
while( !bFound && i < oaAttrs.length ) {
if( oaAttrs.name == sAttName ) {
bFound = true;
if( oaAttrs.values.length > 0 ) {
sRetVal = oaAttrs.values[0];
}
}
i++;
}
return sRetVal;
}
Good luck
4everJang