All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scaffolding.harmonize.sjs.content.sjs Maven / Gradle / Ivy

There is a newer version: 6.1.1
Show newest version
/*
 * 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