quick.xml
quick.xml 使用
export { toCore, toJson };
1
toJson
xml 转为 json
>{}
/**
* 转为json 对象
* @param {*} xml 内容
* @param {*} opts 输出的格式配置参数
* opts:{format:内容格式化方法,默认去除空格,换行等}
*/
// const toJson = (xml, opts) => {}
let _xml = `<person><name>张三</name><age>19</age><gender>男</gender></person>`;
return {
toJson: xml.toJson(_xml),
};
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
toCore
xml 适配 core 注释,转为 json
/**
* 适配core注释,转为json
* @param {*} jsonDoc toJson转换对象
*/
const toCore = jsonDoc =>()
1
2
3
4
5
2
3
4
5