Loading TOC...

NodeBuilder.toNode

NodeBuilder.toNode() as Node

Summary

Return the node tree that has been built.

Usage Notes

It is an error to call toNode on an incomplete node tree, that is, one with open XML element or document nodes. Undefined is returned when toNode is called on an empty NodeBuilder.

Example

const builder = new NodeBuilder();
builder.startElement('ex:example','http://example.com/ns1');
  builder.addText('Some element content here');
builder.endElement();
builder.toNode();

// Returns an XML element node equivalent to the following:
//
// <ex:example xmlns:ex="http://example.com/ns1">
//   Some element content here
// </ex:example>

Example

const builder = new NodeBuilder();
builder.startElement('ex:example','http://example.com/ns1');
  builder.addText('Some element content here');
builder.toNode();

// Throws an exception because the element "ex:example" is not terminated.

Comments

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