Members
NAMESPACES :object
- Description:
Object of known namespaces uses in ODK XForms, with prefixes as used in this validator.
- Source:
Object of known namespaces uses in ODK XForms, with prefixes as used in this validator.
Type:
- object
binds :Array.<Node>
Type:
- Array.<Node>
bindsWithCalc :Array.<Node>
Type:
- Array.<Node>
formControls :Array.<Node>
Type:
- Array.<Node>
groups :Array.<Node>
Type:
- Array.<Node>
instances :Array.<Node>
Type:
- Array.<Node>
items :Array.<Node>
Type:
- Array.<Node>
repeats :Array.<Node>
Type:
- Array.<Node>
setvalues :Array.<Node>
Type:
- Array.<Node>
Methods
_cleanXPathException(error) → {Error|string}
- Description:
Returns cleaned-up XPath Exception error string unless in debug mode.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
error |
Error | Error object |
Returns:
cleaned up error message or original error object
- Type
- Error | string
_cleanXmlDomParserError(error) → {Error|string}
- Description:
Returns a cleaned-up XmlDomParser error string unless in debug mode.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
error |
Error | Error object |
Returns:
cleaned up error message or original error object
- Type
- Error | string
_extractModelStr() → {string|Document}
- Description:
Inefficient method that ensures that the namespaces are included in their expected locations, so Enketo Core knows how to handle them.
- Source:
Returns:
The XML content to apply the stylesheet to given as a string or a libxmljs document.
- Type
- string | Document
_getDom() → {JSDOM}
Returns:
JSDOM instance of the XForm
- Type
- JSDOM
_getExternalDataArray() → {Array.<{id: string}>}
- Description:
Returns some dummy external data that can be used to instantiate a Form instance that requires external data.
- Source:
Returns:
external data object with dummy content
- Type
- Array.<{id: string}>
_join(arr)
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array.<string> | array of strings |
_nodeName(thing, attribute) → {string|null}
- Description:
Returns the model node name that a provided element refers to.
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
thing |
Element | string | The XForm element or path. |
|
attribute |
string |
nodeset
|
The attribute that contains the path. |
Returns:
the node name.
- Type
- string | null
_stripJrChoiceName(expr) → {string}
- Description:
Strips jr:choice-name function.
Since this is such a weird function that queries the body of the XForm, and cannot be evaluated in XPath, we just strip it out.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
expr |
string | The initial expression. |
Returns:
expression after stripping.
- Type
- string
_withFormControl(bind) → {boolean}
- Description:
Determines whether a
<bind>
element has corresponding input form control.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
bind |
Element | The XForm |
Returns:
whether the provided bind has a matching form control
- Type
- boolean
_withoutFormControl(bind) → {boolean}
- Description:
A reverse method of
_withFormControl
- Source:
Parameters:
Name | Type | Description |
---|---|---|
bind |
Element | The XForm |
Returns:
whether the provided bind has no matching form control
- Type
- boolean
checkAppearances() → {Result}
Returns:
Result object with warnings and errors.
- Type
- Result
checkBinds() → {Result}
Returns:
Result object with warnings and errors.
- Type
- Result
checkOpenClinicaRules() → {Result}
Returns:
Result object with warnings and errors.
- Type
- Result
checkStructure() → {Result}
Returns:
Result object with warnings and errors.
- Type
- Result
enketoEvaluate(expr, typeopt, contextPathopt, tryNative) → {Array.<Element>}
- Description:
Evaluates an XPath expression on the XForm's primary instance.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
expr |
string | The expression to evaluate. |
||
type |
string |
<optional> |
string
|
One of boolean, string, number, node, nodes. |
contextPath |
string |
<optional> |
null
|
Query selector. |
tryNative |
boolean |
false
|
Whether it is safe to try the native evaluator (no date comparisons or calculations) |
Returns:
an array of elements.
- Type
- Array.<Element>
getBind(nodeset) → {Node}
- Description:
Returns a
<bind>
element with the provided nodeset attribute value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
nodeset |
string | nodeset attribute value |
Returns:
bind element matching the nodeset value
- Type
- Node
getSetvalue(ref) → {Node}
- Description:
Returns a
<setvalue>
element with the provided ref attribute value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ref |
string | ref attribute value |
Returns:
setvalue element matching the nodeset value
- Type
- Node
nodeExists(path) → {Element|null}
Parameters:
Name | Type | Description |
---|---|---|
path |
string | simple path to node |
Returns:
the result element or null if not found
- Type
- Element | null
nsPrefixResolver(ns) → {string}
Parameters:
Name | Type | Description |
---|---|---|
ns |
string | One of predefined |
Returns:
namespace prefix.
- Type
- string