1.2.3 • Published 3 years ago

wx-xml2js v1.2.3

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

wx-xml2js

Copy xml2js and adapt it to wechat.

Description

For options, please refer to: xml2js


npm install wx-xml2js

or

yarn add wx-xml2js

Convert xml to json:

import xml2js from 'wx-xml2js'
xml2js.parseString(xml, (err, result) => {
  if(err) {
    // some thing
  }
})

Convert json to xml:

import xml2js from 'wx-xml2js'
var jsonData = '<xml><ToUserName>abc</ToUserName></xml>'
var builder = new xml2js.Builder({
  rootName: 'xml',
  headless: true,
  cdata: true,
  renderOpts: {
    pretty: true,
    indent: '',
    newline: '' 
  }
});
var xmlData = builder.buildObject(jsonData);
1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago