Abstract
Private
argumentA list of functions that modify a factory's parameter list.
Private
attributeA map which assigns an attribute namespace to a handler function.
Private
attributeA map which assigns a single character string prefix to a string deserializer.
Private
domThe DOMParser to actually parse the XML into nodes
Private
elementA map which assigns an element name to a an XML element deserializer.
Private
factoriesA map which assigns a factory function to an element name.
Private
parameterA map which defines custom parameter modes.
Private
postA list of functions that are invoked after a widget is instanced, so that the instance can be modified post-initialization.
Private
validatorsA map which assigns a validator function to a unique name, allowing a validator to be referred to by string. Referred to as built-in validators.
Auto-register a factory for a given widget. Instead of passing an input mapping and name, these are instead supplied in the Widget.autoXML field of the widget class. If it's null, an error is thrown.
The class to auto-register
Find the next unset parameter of a given mode.
The input mapping of the widget being built
A list containing which of the parameters in the input mapping are already set
The parameter mode to find
Returns the index of the next unset parameter of the wanted mode. If none are found, -1 is returned.
Private
instantiateCreate a new widget instance given a config and context
Parse a value in an attribute. The value will be deserialized according to its prefix. If there is no prefix, the value is treated as a string.
The value in the attribute, with the prefix included
The current parser context, which will be passed to a deserializer if the value is prefixed with a registered deserializer prefix
Parse an XML string. BaseXMLUIParser#parseFromXMLDocument will be called.
A string containing an XML document
Optional
config: XMLUIParserConfigThe configuration object to use for the parser
Returns a pair containing, respectively, a Map which maps a UI tree name to a widget, and the parser context after all UI trees are parsed
Parse an XML string from a URL. BaseXMLUIParser#parseFromString will be called.
The URL to download the XML from
Optional
config: XMLUIParserConfigThe configuration object to use for the parser
Optional
requestOptions: RequestInitOptions to use for the HTTP request
Returns a pair containing, respectively, a Map which maps a UI tree name to a widget, and the parser context after all UI trees are parsed. Returned asynchronously as a promise
Parse an XML document which can contain multiple
The XML document to parse
Optional
config: XMLUIParserConfigThe configuration object to use for the parser
Returns a pair containing, respectively, a Map which maps a UI tree name to a widget, and the parser context after all UI trees are parsed
Parse a
A bare-bones XML UI parser. This must not be used directly as this is an extensible parser; you are supported to create a subclass of this and add all the features/validators that you need.
You won't need to create your own parser unless you have an XML format that is not compatible with the default format. Most times it's enough to use XMLUIParser and register new features if necessary.