XFormParser class final

Parses an XForm into a FormDef.

Port of org.javarosa.xform.parse.XFormParser. Everything JavaRosa keeps in static registries (action handlers, processors) is configured per parser. Parsing is asynchronous only because external secondary instances are read through a ResourceResolver.

Constructors

XFormParser({ResourceResolver? resolver, ExternalInstanceParser? externalInstanceParser, SetGeopointAction setGeopointAction(TreeReference target)?})
Creates a parser reading jr:// resources through resolver.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addProcessor(Object processor) → void
Adds a plugin processor: any of BindAttributeProcessor, FormDefProcessor, ModelAttributeProcessor, QuestionProcessor, XPathProcessor or ExternalDataInstanceProcessor.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(void callback(String error)) → void
Receives each non-fatal parse error.
onWarning(void callback(String error)) → void
Receives each parse warning.
parse(String formXml, {String? formXmlSrc, String? lastSavedSrc, String? instanceXml, AnswerResolver answerResolver = defaultAnswerResolver, bool restoringCachedForm = false}) → Future<FormDef>
Parses formXml. lastSavedSrc is the src to use for jr://instance/last-saved. With instanceXml (a saved instance), its answers replace the blank instance (typed by answerResolver).
registerActionHandler(String name, ActionElementHandler handler) → void
Registers handler for action elements called name (local name); it runs after the generic event checks.
registerActionTarget(TreeReference target) → void
Records a node an action sets (verified once the instance exists).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

validEventNames(String? events) → List<String>
The events in the space-separated events; throws for unsupported ones. Port of XFormParser.getValidEventNames.