scaffolding.harmonize.sjs.content.sjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of marklogic-data-hub Show documentation
Show all versions of marklogic-data-hub Show documentation
Library for Creating an Operational Data Hub on MarkLogic
/*
* Create Content Plugin
*
* @param id - the identifier returned by the collector
* @param options - an object containing options. Options are sent from Java
*
* @return - your content
*/
function createContent(id, options) {
var doc = cts.doc(id);
var root = doc.root;
// for xml we need to use xpath
if (root && xdmp.nodeKind(root) === 'element') {
return root.xpath('/*:envelope/*:instance/node()');
}
// for json we need to return the instance
else if (root && root.envelope && root.envelope.instance) {
return root.envelope.instance;
}
// for everything else
else {
return doc;
}
}
module.exports = {
createContent: createContent
};
© 2015 - 2024 Weber Informatics LLC | Privacy Policy