
NodeBuilder.addText( text as String ) as This NodeBuilder object
Add a text node to the node tree the builder is building.
| Parameters | |
|---|---|
| text | The contents of the text node. |
Adjacent text nodes will be merged in the tree produced by the builder
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>