Loading TOC...

MarkLogic Server 11.0 Product Documentation
NodeBuilder.addText

NodeBuilder.addText(
   text as String
) as This NodeBuilder object

Summary

Add a text node to the node tree the builder is building.

Parameters
text The contents of the text node.

Usage Notes

Adjacent text nodes will be merged in the tree produced by the builder

Example

const builder = new NodeBuilder();
builder.startElement('para');
  builder.addText('This is part of my paragraph. ');
  builder.addText('And this is more of it. ');
  builder.addText('In the end, there will only be one text node. ');
builder.endElement();
builder.toNode();

// Returns an XML element node equivalent to the following:
// <para>This is part of my paragraph. And this is more of it. In the end, there will only be one text node. </para>

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.