HPDFXFAResolveFormSOM Function

Unit: HPDFXFAFormSOM

Resolve a bounded SOM expression against an actual root, owner and owner-data context, returning TXFAFormSOMTargets with each accepted node, its data node and explicit-instance-context flag

function HPDFXFAResolveFormSOM(Document: TXFADocument;
  Root, Owner, OwnerData: TXFANode; const Reference: AnsiString;
  Tick: TXFAFormSOMTick; PropertyValue: TXFAFormSOMProperty;
  Scope: TXFAFormSOMScope; const Insertions: TXFAFormSOMInsertions;
  Predicate: TXFAFormSOMPredicate = nil;
  const ContextIdentity: string = ''; Replay: Boolean = False;
  TemplateOnly: Boolean = False; Refresh: TXFAFormSOMRefresh = nil;
  AllowXMLID: Boolean = True;
  Reserve: TXFAFormSOMReserve = nil): TXFAFormSOMTargets;

Context and callbacks

Document owns the nodes; Root selects the searched tree and Owner with OwnerData supplies the starting context

Tick charges work to the caller, PropertyValue reads runtime properties, Scope supplies accepted instance scope and Insertions supplies explicitly accepted virtual placements

Predicate evaluates computed selectors in candidate context; ContextIdentity and Replay describe that evaluation, while Refresh can adopt accepted current nodes around a predicate mutation barrier

TemplateOnly selects structural traversal without ordinary Form data-binding expansion; it is also used by callers that need structural Data traversal

Optional workspace reservations

Version 2.1203.0 adds TXFAFormSOMReserve = procedure(Bytes: Int64) of object and the optional trailing Reserve argument; nil preserves ordinary caller-owned allocation behavior

The resolver synchronously requests a conservative byte allowance, including allocation overhead, before producing its parser strings, filter and step arrays, traversal lists, binding and identity tables, refresh remapping, output arrays and explicit callback objects; the callback raises an exception to refuse the allocation

Keep each accepted allowance until the query and its returned target array have both finished being consumed; the resolver does not issue release callbacks or transfer an ownership interface with its raw result array

The callback must preserve the document, input arrays and query context, and must reject reentrant changes that would retire those inputs; native owned event queries supply their existing generation guard and retain the reservations in the caller query scope

Reservations cover resolver-owned workspace, not the internal storage of supplied Scope, PropertyValue, Predicate or Refresh callbacks, DOM helpers, locale services or snapshot recovery; callback result storage remains the responsibility of its producer

Leading class selectors and XML IDs

Version 2.1188.0 adds the optional trailing AllowXMLID argument; its default True preserves the existing leading-hash Template XML-ID lookup when TemplateOnly is False

Pass False for a pure SOM query whose leading hash introduces a class selector, such as #field, #field[1], #field[*], #occur or #subform.[amount eq 20].amount

The provider-free native FormCalc query host passes False for ordinary resolveNode and resolveNodes calls, so a colliding Template XML ID cannot replace the actual class-selected Form object

A first class step searches current children before the existing scope fallback; a root-self class result remains available when the root has no child candidate of that class

The default ID route returns the Template target and owner data; it does not establish a current repeated Form-instance mapping or authorize writing that Template object as a live Form object

Class siblings and transparent names

Version 2.1188.2 keeps class wildcard, occurrence and relative-index queries within the actual parent collection, including named and unnamed siblings without merging nodes from nested transparent containers

Native FormCalc and enabled-provider JavaScript classAll and classIndex follow that actual sibling membership; ordinary name lookup remains transparent and an explicit descendant query can still search through nested containers

For example, if main owns fields a and b and an unnamed subform containing another field, main's direct field class query counts only its own field siblings; indexing that class cannot redirect a write into the unnamed child's field

Saving retains the actual unnamed Form structure and values; the correction does not flatten containers or change event transaction limits

Limits and lifetime

Tree/path depth and resolver work are bounded and charged through the supplied callback; invalid syntax and unhandled predicate failures propagate to the caller

Results borrow document nodes; callers must use accepted identity and mutation-barrier rules instead of retaining raw pointers across a rebuild

The native event runtime retains its transaction, exact rollback and ordinary retired-reference behavior

The native query profile leaves the separate event-ref compatibility route unchanged; version 2.1188.1 separately corrects enabled-provider JavaScript class child queries while retaining actual Form and Template roots

See native FormCalc events, input references and remerge and native instance managers