Loading TOC...

NodeBuilder.endDocument

NodeBuilder.endDocument() as This NodeBuilder object

Summary

Close out the current document node.

Usage Notes

Document 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 endDocument is called when there is an open element node.

Example

const builder = new NodeBuilder();
builder.startDocument();
  builder.addNode( ['array','of','strings'] );
builder.endDocument();
builder.toNode();

// Returns a JSON array node equivalent to the following:
//
// ["array", "of", "strings"]

Example

const builder = new NodeBuilder();
builder.startDocument();
  builder.startElement("dangling")
  builder.addText("Some content");
builder.endDocument();
builder.toNode();

// Throws an exception because the element "dangling" is not terminated.

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy