Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function fromXML(xmlStr, typeName, options, callback) {
if (!_.isString(typeName)) {
callback = options;
options = typeName;
typeName = 'bpmn:Definitions';
}
if (_.isFunction(options)) {
callback = options;
options = {};
}
var model = instance();
var reader = new xml.Reader(model, options);
var rootHandler = reader.handler(typeName);
reader.fromXML(xmlStr, rootHandler, function(err, result) {
callback(err, result, rootHandler.context);
});
}
BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options, done) {
if (!isString(typeName)) {
done = options;
options = typeName;
typeName = 'bpmn:Definitions';
}
if (isFunction(options)) {
done = options;
options = {};
}
var reader = new Reader(assign({ model: this, lax: true }, options));
var rootHandler = reader.handler(typeName);
reader.fromXML(xmlStr, rootHandler, done);
};
function fromXML(xmlStr, typeName, options, callback) {
if (!_.isString(typeName)) {
callback = options;
options = typeName;
typeName = 'bpmn:Definitions';
}
if (_.isFunction(options)) {
callback = options;
options = {};
}
var reader = new xml.Reader(model, options);
var rootHandler = reader.handler(typeName);
reader.fromXML(xmlStr, rootHandler, function(err, result) {
callback(err, result, rootHandler.context);
});
}