XML data model

The XML data model describes a class that inherits all functions described in the Dataset class.

Query language

The XML data model expects a well-formed XML backing file ( refer to the XML 1.0 specification), which is parsed with support for namespaces into an XML document object model (DOM). The object model is then queried with an XPath 1.0 expression using the root node as the context node.

Namespaces

Namespace prefixes in the query expression are resolved into namespace URIs using the prefix map provided to the query functions as a second argument. If the map argument is omitted or null, the default prefix map is used for resolving prefixes.

Result data types

The value of an XPath expression can have several data types (a node set with several elements, the text value of an attribute, a number returned by the count() function, the Boolean result of a comparison). The value is converted to one of the data types string, number, or Boolean using XPath 1.0 semantics – which may very well differ from the conversion semantics in the scripting language. For example the XPath 1.0 conversion from string to Boolean returns true for all non-empty strings (including the string "false").

Query functions

evalToString( xpath : String, prefix-map : Map ) : String

Evaluates the XPath 1.0 expression against the backing file and returns the result after converting it to a string value with the XPath 1.0 string() function.

evalToNumber( xpath : String, prefix-map: Map ) : Number

Evaluates the XPath 1.0 expression against the backing file and returns the result after converting it to a numeric value with the XPath 1.0 number() function.

evalToBoolean( xpath : String, prefix-map: Map ) : Boolean

Evaluates the XPath 1.0 expression against the backing file and returns the result after converting it to a Boolean value with the XPath 1.0 boolean() function.