Performance considerations for XML Form Object Model expressions

The Adobe XML Form Object Model uses an approach to building forms that distinguishes among form layout, the form design, and the form data.

In a form design, reference syntax expressions associate objects with values, objects, and properties within the tree hierarchy of a Document Object Model (DOM). Reference syntax expressions are usually written into form logic, in validations, calculations, or other business rules.

Consider these tips to reduce the processing time required for resolving reference syntax expressions:

  • Keep expressions as simple as possible.

  • Avoid using “..” (double periods) in expressions.

In addition, after evaluating reference syntax in a script, store the result in an object variable. This result can be retrieved if the reference syntax is used again. Reusing a result is more efficient than re-evaluating the expression.

In the following example, the resolveNode method is used once, and the resulting object reference is saved and reused to manipulate various related objects. This script can be processed more efficiently than one that uses a reference syntax expression for each object and uses the resolveNode method on each one.

var oSubform = xfa.resolveNode("xfa.form.form1.Subform1"); 
if (oSubform.all.length< 3) { 
      Subform.SubformUpButton1.presence = "invisible"; 
      Subform.SubformLabel1.presence = "invisible"; 
      Subform.SubformUpButton2.presence = "invisible"; 
      Subform.SubformLabel2.presence = "invisible"; 
 }

// Ethnio survey code removed