NodeBuilder.startDocument( [uri as String] ) as This NodeBuilder object
Start a new document node in the node tree the builder is building.
Parameters | |
---|---|
uri | The document URI. |
Document nodes may only be added to an empty node tree.
There is no relationship between the URI of the document and the nodes that may be added to that document. In particular, "example.xml" could contain JSON nodes, and "example.json" could contain XML nodes.
const builder = new NodeBuilder(); builder.startDocument('meta.json'); builder.addNode( {author: 'Mary', date: '2014-10-06', keywords: ['example','JSON']} ) builder.endDocument(); builder.toNode(); // Returns a JSON document node equivalent to the following: // // {"author":"Mary", "date":"2014-10-06", "keywords":["example", "JSON"]}
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.