- Source:
Members
(static) examXML :XMLDocument
XML for the current exam.
Type:
- Source:
(static) templates :Object.<XMLDocument>
XSLT stylesheets.
Type:
- Source:
Methods
(static) getTextContent(elem) → {string}
Get all the text belonging to an element.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element |
Returns:
Type | Description |
---|---|
string |
- Source:
(static) isEmpty(node) → {boolean}
Is the given node empty? True if it has no children.
Parameters:
Name | Type | Description |
---|---|---|
node |
Element |
Returns:
Type | Description |
---|---|
boolean |
- Source:
(static) loadFunctions(xml) → {Array.<Numbas.jme.variables.func_data>}
Load user-defined functions from an XML node.
Parameters:
Name | Type | Description |
---|---|---|
xml |
Element |
Returns:
Type | Description |
---|---|
Array.<Numbas.jme.variables.func_data> |
- Source:
(static) loadVariables(xml, scope) → {Array.<Numbas.jme.variables.variable_data_dict>}
Load variable definitions from an XML node.
Parameters:
Name | Type | Description |
---|---|---|
xml |
Element | |
scope |
Numbas.jme.Scope | Scope to compile relative to. |
Returns:
Type | Description |
---|---|
Array.<Numbas.jme.variables.variable_data_dict> |
- Source:
(static) loadXML(xmlstring) → {XMLDocument}
Load in a single XML document.
Parameters:
Name | Type | Description |
---|---|---|
xmlstring |
string |
Returns:
Type | Description |
---|---|
XMLDocument |
- Source:
(static) localise(template) → {Element}
Replace every <localise>
tag with its contents, run through localisation, i.e. get localised strings.
Parameters:
Name | Type | Description |
---|---|---|
template |
Element |
Returns:
Type | Description |
---|---|
Element |
- Source:
(static) serializeMessage(node) → {string}
Lots of the time we have a message stored inside content/html/.. structure.
This pulls the message out and serializes it so it can be inserted easily with jQuery.
Parameters:
Name | Type | Description |
---|---|---|
node |
Element |
Returns:
Type | Description |
---|---|
string |
- Source:
(static) setTextContent(elem, text)
Set the text content of an element.
Parameters:
Name | Type | Description |
---|---|---|
elem |
Element | |
text |
string |
- Source:
(static) transform(template, xml) → {string}
Transform an XML node using the given XSL template, returning a string representation of the transformed XML.
Parameters:
Name | Type | Description |
---|---|---|
template |
Element | |
xml |
Element |
Returns:
Type | Description |
---|---|
string |
- Source:
(static) tryGetAttribute(obj, xmlroot, elem, names, altnamesopt, options) → {object}
Try to get attributes from an XML node, and use them to fill in an object's properties if they're present. If obj
is null, then the loaded value is just returned.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
object | Object to fill up. |
|
xmlroot |
Element | Root XML element. |
|
elem |
Element | string | Either an XML node to get attributes from, or an XPath query to get the element from |
|
names |
Array.<string> | Names of attributes to load. |
|
altnames |
Array.<string> |
<optional> |
Names of object properties to associate with attribute names. If undefined, the attribute name is used. |
options |
Numbas.xml.tryGetAttribute_options |
Returns:
Type | Description |
---|---|
object |
|
- Source:
Type Definitions
tryGetAttribute_options
Type:
Properties:
Name | Type | Description |
---|---|---|
string |
boolean | Always return the attribute as a string. |
- Source: