Loading TOC...

MarkLogic 9 Product Documentation
NodeBuilder.addProcessingInstruction

NodeBuilder.addProcessingInstruction(
   target as String,
   text as String
) as This NodeBuilder object

Summary

Add an XML processing instruction node to the node tree the builder is building.

Parameters
target The processing instruction target.
text The contents of the processing instruction.

Usage Notes

Processing instruction nodes may only be added to XML documents.

Example

const builder = new NodeBuilder();
builder.startDocument();
  builder.addProcessingInstruction(
    'xml-stylesheet','href="mystyles.css" type="text/css"');
  builder.addElement('doc','My simple document with a stylesheet');
builder.endDocument();
builder.toNode();

// Returns an XML document node equivalent to the following:
//
// ?xml version="1.0" encoding="UTF-8"?>
// <?xml-stylesheet href="mystyles.css" type="text/css"?>
// <doc>My simple document with a stylesheet</doc>

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