Skip to main content

Class: DomDataAdapter

Defined in: lang-xquery/src/language/data-adapter.ts:94

XQuery data adapter based on DOM. It can also access JavaScript object attributes with the attribute axis.

Implements

Constructors

Constructor

new DomDataAdapter(doc): DomDataAdapter

Defined in: lang-xquery/src/language/data-adapter.ts:98

Parameters

ParameterTypeDescription
docDocumentThe DOM Document used for all node creation operations.

Returns

DomDataAdapter

Properties

doc

protected doc: Document

Defined in: lang-xquery/src/language/data-adapter.ts:98

The DOM Document used for all node creation operations.


treeStep

treeStep: (test, axis) => (node) => Node[]

Defined in: lang-xquery/src/language/data-adapter.ts:121

Create an XPath step function.

Creates a DOM-based axis step function that traverses axis and filters nodes matching test.

Parameters

ParameterType
testASTItemType
axisAxisType

Returns

(node) => Node[]

Throws

When test.kind names an item kind without a DOM nodeType mapping.

Param

test

The item test to apply.

Param

axis

The axis to use.

Implementation of

XQueryDataAdapter.treeStep

Methods

addAttribute()

addAttribute(el, attr): void

Defined in: lang-xquery/src/language/data-adapter.ts:194

Add an attribute to an element.

Parameters

ParameterTypeDescription
elElementThe element to add the attribute to.
attrAttrThe attribute to add.

Returns

void

Implementation of

XQueryDataAdapter.addAttribute


appendItem()

protected appendItem(node, item): void

Defined in: lang-xquery/src/language/data-adapter.ts:184

Appends item to node: attributes are set via setAttributeNodeNS, other Node instances are appended as children, and primitives are serialized to text nodes.

Parameters

ParameterType
nodeNode
itemunknown

Returns

void


atomize()

atomize(value): unknown

Defined in: lang-xquery/src/language/data-adapter.ts:110

Atomize a value.

Parameters

ParameterTypeDescription
valueunknownThe value to atomize.

Returns

unknown

Implementation of

XQueryDataAdapter.atomize


cloneNode()

cloneNode(node): Node

Defined in: lang-xquery/src/language/data-adapter.ts:106

Create deep copy of a node.

Parameters

ParameterType
nodeNode

Returns

Node

Implementation of

XQueryDataAdapter.cloneNode


createAttribute()

createAttribute(ns, qname, content): Attr

Defined in: lang-xquery/src/language/data-adapter.ts:132

Create an attribute node.

Parameters

ParameterTypeDescription
nsstringThe namespace URI.
qnamestringThe attribute name.
contentstringThe attribute value.

Returns

Attr

Implementation of

XQueryDataAdapter.createAttribute


createComment()

createComment(content): Comment

Defined in: lang-xquery/src/language/data-adapter.ts:139

Create a comment node.

Parameters

ParameterTypeDescription
contentstringThe comment content.

Returns

Comment

Implementation of

XQueryDataAdapter.createComment


createDocument()

createDocument(ns, qname, content): Element | Document

Defined in: lang-xquery/src/language/data-adapter.ts:143

Create a document node.

Parameters

ParameterTypeDescription
nsstringThe namespace URI.
qnamestringThe document name.
contentunknown[]The child nodes.

Returns

Element | Document

Implementation of

XQueryDataAdapter.createDocument


createElement()

createElement(ns, qname, content): Element

Defined in: lang-xquery/src/language/data-adapter.ts:123

Create an element node.

Parameters

ParameterTypeDescription
nsstringThe namespace URI.
qnamestringThe element name.
contentunknown[]The child nodes.

Returns

Element

Implementation of

XQueryDataAdapter.createElement


createNS()

createNS(name, content): Attr

Defined in: lang-xquery/src/language/data-adapter.ts:155

Create a namespace node.

Parameters

ParameterTypeDescription
namestringThe namespace prefix.
contentstringThe namespace URI.

Returns

Attr

Implementation of

XQueryDataAdapter.createNS


createProcInstr()

createProcInstr(name, content): ProcessingInstruction

Defined in: lang-xquery/src/language/data-adapter.ts:168

Create a processing instruction node.

Parameters

ParameterTypeDescription
namestringThe processing instruction name.
contentstringThe processing instruction content.

Returns

ProcessingInstruction

Implementation of

XQueryDataAdapter.createProcInstr


createText()

createText(content): Text

Defined in: lang-xquery/src/language/data-adapter.ts:164

Create a text node.

Parameters

ParameterTypeDescription
contentstringThe text content.

Returns

Text

Implementation of

XQueryDataAdapter.createText


isNode()

isNode(node): node is Node

Defined in: lang-xquery/src/language/data-adapter.ts:102

Is the value a Node?

Parameters

ParameterType
nodeunknown

Returns

node is Node

Implementation of

XQueryDataAdapter.isNode


lookupNSUri()

lookupNSUri(el, prefix): string

Defined in: lang-xquery/src/language/data-adapter.ts:175

Lookup the namespace URI for a given element.

Parameters

ParameterTypeDescription
elNodeThe element to look up the URI for.
prefixstringThe namespace prefix.

Returns

string

Implementation of

XQueryDataAdapter.lookupNSUri


lookupPrefix()

lookupPrefix(el, ns): string

Defined in: lang-xquery/src/language/data-adapter.ts:172

Lookup the namespace prefix for a given element.

Parameters

ParameterTypeDescription
elElement | DocumentThe element to look up the prefix for.
nsstringThe namespace URI.

Returns

string

Implementation of

XQueryDataAdapter.lookupPrefix