Nodeset

Nodeset

new Nodeset(selectoropt, indexopt, filteropt, model)

Source:

Class dealing with nodes and nodesets of the XML instance

Parameters:
Name Type Attributes Description
selector string <optional>

SimpleXPath or jQuery selector

index number <optional>

The index of the target node with that selector

filter NodesetFilter <optional>

Filter object for the result nodeset

model FormModel

Instance of FormModel

Methods

convert(xopt, xmlDataTypeopt) → {string}

Source:

Convert a value to a specified data type (though always stringified)

Parameters:
Name Type Attributes Description
x string <optional>

Value to convert

xmlDataType string <optional>

XML data type

Returns:
  • String representation of converted value
Type
string

getClosestRepeat() → {Object|Object}

Source:

Note: If repeats have not been cloned yet, they are not considered a repeat by this function

Returns:

Empty object for nothing found

Type
Object | Object

getElement() → {Element}

Source:
Returns:

Single node

Type
Element

getElements() → {Array.<Element>}

Source:
Returns:

List of nodes

Type
Array.<Element>

getVal() → {string|undefined}

Source:

Obtains the data value of the first node.

Returns:

data value of first node or undefined if zero nodes

Type
string | undefined

isRequired(expropt) → {boolean}

Source:
Parameters:
Name Type Attributes Description
expr string <optional>

The XPath expression

Returns:

Whether node is required

Type
boolean

remove()

Source:

Remove a repeat node

setIndex(indexopt)

Source:

Sets the index of the Nodeset instance

Parameters:
Name Type Attributes Description
index number <optional>

The 0-based index

setVal(newValsopt, xmlDataTypeopt) → {null|UpdatedDataNodes}

Source:

Sets data node values.

Parameters:
Name Type Attributes Description
newVals string | Array.<string> <optional>

The new value of the node.

xmlDataType string <optional>

XML data type of the node

Returns:

null is returned when the node is not found or multiple nodes were selected, otherwise an object with update information is returned.

Type
null | UpdatedDataNodes

validate(constraintExpr, requiredExpr, xmlDataType) → {Promise}

Source:
Parameters:
Name Type Description
constraintExpr string

The XPath expression

requiredExpr string

The XPath expression

xmlDataType string

XML data type

Returns:

promise that resolves with a ValidateInputResolution object

Type
Promise

validateConstraintAndType(expropt, xmlDataTypeopt) → {Promise}

Source:

Validate a value with an XPath Expression and /or xml data type

Parameters:
Name Type Attributes Description
expr string <optional>

The XPath expression

xmlDataType string <optional>

XML data type

Returns:

wrapping a boolean indicating if the value is valid or not; error also indicates invalid field, or problem validating it

Type
Promise

validateRequired(expropt) → {Promise.<boolean>}

Source:

Validates if requiredness is fulfilled.

Parameters:
Name Type Attributes Description
expr string <optional>

The XPath expression

Returns:

Promise that resolves with a boolean

Type
Promise.<boolean>