NodeBuilder.endElement

NodeBuilder.endElement() as This NodeBuilder object

Summary

Close out the current XML element node.

Usage Notes

Element nodes must be completed before calling toNode() on the builder; an error will be raised if they are not. An error will also be raised if endElement is called when there is no open element node.

Example

const builder = new NodeBuilder();
builder.startElement('p');
  builder.addText('Some content');
builder.endElement();
builder.toNode();

// Returns the following XML element node:
//
// <p>Some content</p>

Example

const builder = new NodeBuilder();
builder.startElement('root')
  builder.addText('Some content');
builder.endElement();
builder.endElement();
builder.toNode();

// throws an XDMP-ENDELEMENT exception
Powered by MarkLogic Server | Terms of Use | Privacy Policy