egg-plugin-xml
v1.2.1
Published
An eggjs plugin for parsing xml
Downloads
3
Maintainers
Readme
egg-plugin-xml
An eggjs plugin for parsing xml
Install
# use pnpm
$ pnpm install egg-plugin-xml
# use yarn
$ yarn add egg-plugin-xml
Usage
// {app_root}/config/plugin.js
exports.xmlParser = {
enable: true,
package: 'egg-plugin-xml'
}
Configuration
egg-plugin-xml support all configurations in xml2js.
eg. Do not always put child nodes in an array
// {app_root}/config/config.default.js
exports.xmlParser = {
limit: '2mb',
encoding: 'utf8',
key: 'body',
xmlOptions: {
explicitArray: false
}
}
eg. Convert camel to underscore delimited
// {app_root}/config/config.default.js
exports.xmlParser = {
normalizeTags: true // or: normalizeTags: '-'
}
Extends
// {app_root}/app/extend/helper.js
const { helper } = ctx
helper.parserXML()
helper.getXMLBody()
Change logs
Questions & Suggestions
Please open an issue here.