48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
|
|
const defaultOptions = {
|
|
preserveOrder: false,
|
|
attributeNamePrefix: '@_',
|
|
attributesGroupName: false,
|
|
textNodeName: '#text',
|
|
ignoreAttributes: true,
|
|
removeNSPrefix: false, // remove NS from tag name or attribute name if true
|
|
allowBooleanAttributes: false, //a tag can have attributes without any value
|
|
//ignoreRootElement : false,
|
|
parseTagValue: true,
|
|
parseAttributeValue: false,
|
|
trimValues: true, //Trim string values of tag and attributes
|
|
cdataPropName: false,
|
|
numberParseOptions: {
|
|
hex: true,
|
|
leadingZeros: true,
|
|
eNotation: true
|
|
},
|
|
tagValueProcessor: function(tagName, val) {
|
|
return val;
|
|
},
|
|
attributeValueProcessor: function(attrName, val) {
|
|
return val;
|
|
},
|
|
stopNodes: [], //nested tags will not be parsed even for errors
|
|
alwaysCreateTextNode: false,
|
|
isArray: () => false,
|
|
commentPropName: false,
|
|
unpairedTags: [],
|
|
processEntities: true,
|
|
htmlEntities: false,
|
|
ignoreDeclaration: false,
|
|
ignorePiTags: false,
|
|
transformTagName: false,
|
|
transformAttributeName: false,
|
|
updateTag: function(tagName, jPath, attrs){
|
|
return tagName
|
|
},
|
|
// skipEmptyListItem: false
|
|
};
|
|
|
|
const buildOptions = function(options) {
|
|
return Object.assign({}, defaultOptions, options);
|
|
};
|
|
|
|
exports.buildOptions = buildOptions;
|
|
exports.defaultOptions = defaultOptions; |