Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
preserveChildrenOrder: false,
charsAsChildren: false,
includeWhiteChars: false,
async: false,
strict: true,
attrNameProcessors: undefined,
attrValueProcessors: undefined,
tagNameProcessors: undefined,
valueProcessors: undefined
}, (err: Error, result: any) => { });
xml2js.parseString('Hello xml2js!', {
attrNameProcessors: [processors.firstCharLowerCase, xml2js.processors.normalize],
attrValueProcessors: [processors.normalize],
tagNameProcessors: [processors.stripPrefix],
valueProcessors: [processors.parseBooleans, processors.parseNumbers]
}, (err: Error, result: any) => { });
let builder = new xml2js.Builder({
renderOpts: {
pretty: false
}
});
builder = new xml2js.Builder({
rootName: 'root',
renderOpts: {
pretty: true,
indent: ' ',
newline: '\n'
},
xmldec: {
preserveChildrenOrder: false,
charsAsChildren: false,
includeWhiteChars: false,
async: false,
strict: true,
attrNameProcessors: undefined,
attrValueProcessors: undefined,
tagNameProcessors: undefined,
valueProcessors: undefined
}, (err: any, result: any) => { });
xml2js.parseString('Hello xml2js!', {
attrNameProcessors: [processors.firstCharLowerCase],
attrValueProcessors: [processors.normalize],
tagNameProcessors: [processors.stripPrefix],
valueProcessors: [processors.parseBooleans, processors.parseNumbers]
}, (err: any, result: any) => { });
var builder = new xml2js.Builder({
renderOpts: {
pretty: false
}
});
var builder = new xml2js.Builder({
rootName: 'root',
renderOpts: {
pretty: true,
indent: ' ',
newline: '\n'
},
xmldec: {
function readXmlAsJson(filePath, simplify) {
var xmlData;
var parsedData;
var parserOptions = {};
if (simplify) {
parserOptions = {
attrValueProcessors: [xml2jsProcessors.parseNumbers, xml2jsProcessors.parseBooleans],
explicitArray: false,
mergeAttrs: true,
explicitRoot: false
};
}
var xmlParser = new xml2js.Parser(parserOptions);
try {
xmlData = fs.readFileSync(filePath);
xmlParser.parseString(xmlData, function(err, data) {
if (data) {
parsedData = data;
}
});
} catch (err) {}