When working with elements, it can be important to know an element's definition name. If you start with an element, you need to:
The following script displays the definition name of the highest level element in the main flow.
NOTE: The name returned is that in the EDD rather than in your DTD or schema.
function getElementName(elem) {
var elemDef, name = null;
elemDef = elem.ElementDef;
if (elemDef.ObjectValid()) {
name = elemDef.Name;
}
return name;
}
var doc, flow, root, name;
doc = app.ActiveDoc;
flow = doc.MainFlowInDoc;
root = flow.HighestLevelElement;
if (root.ObjectValid()) {
name = getElementName(root);
if (name !== null) {
Alert(name, Constants.FF_ALERT_CONTINUE_NOTE);
} else {
Alert("Text node", Constants.FF_ALERT_CONTINUE_NOTE);
}
}
- Get the associated element definition.
- Get the definition name.
The following script displays the definition name of the highest level element in the main flow.
NOTE: The name returned is that in the EDD rather than in your DTD or schema.
function getElementName(elem) {
var elemDef, name = null;
elemDef = elem.ElementDef;
if (elemDef.ObjectValid()) {
name = elemDef.Name;
}
return name;
}
var doc, flow, root, name;
doc = app.ActiveDoc;
flow = doc.MainFlowInDoc;
root = flow.HighestLevelElement;
if (root.ObjectValid()) {
name = getElementName(root);
if (name !== null) {
Alert(name, Constants.FF_ALERT_CONTINUE_NOTE);
} else {
Alert("Text node", Constants.FF_ALERT_CONTINUE_NOTE);
}
}
No comments:
Post a Comment