MCPcopy
hub / github.com/scality/cloudserver / parseXML

Function parseXML

lib/utilities/parseXML.js:11–23  ·  view source on GitHub ↗

* Handle initial parsing of XML using the `xml2js.parseString` method * @param {string} xml - The XML to be parsed * @param {object} log - Werelogs logger * @param {function} cb - Callback to call * @return {undefined}

(xml, log, cb)

Source from the content-addressed store, hash-verified

9 * @return {undefined}
10 */
11function parseXML(xml, log, cb) {
12 if (!xml) {
13 log.debug('request xml is missing');
14 return cb(errors.MalformedXML);
15 }
16 return xml2js.parseString(xml, (err, result) => {
17 if (err) {
18 log.debug('request xml is malformed');
19 return cb(errors.MalformedXML);
20 }
21 return cb(null, result);
22 });
23}
24
25module.exports = parseXML;

Callers 4

bucketPutNotificationFunction · 0.85
bucketPutLifecycleFunction · 0.85
bucketPutObjectLockFunction · 0.85

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected