Loading TOC...

MarkLogic Server 11.0 Product Documentation
NodeBuilder.addComment

NodeBuilder.addComment(
   comment as String
) as This NodeBuilder object

Summary

Add an XML comment node to the node tree the builder is building.

Parameters
comment The text of the comment.

Usage Notes

Comment nodes may only be added to XML nodes.

Example

const builder = new NodeBuilder();
builder.startElement('example');
  builder.addComment('There is no content in this element, just a comment');
builder.endElement();
builder.toNode();

// Returns an XML element node equivalent to the following:
// <example><!--There is no content in this element, just a comment--></example>

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