NodeBuilder.endElement() as This NodeBuilder object
Close out the current XML element node.
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.
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>
const builder = new NodeBuilder(); builder.startElement('root') builder.addText('Some content'); builder.endElement(); builder.endElement(); builder.toNode(); // throws an XDMP-ENDELEMENT exception
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.