15.1.1 • Published 3 years ago

xmlbuilder v15.1.1

Weekly downloads
14,839,565
License
MIT
Repository
github
Last release
3 years ago

xmlbuilder-js

An XML builder for node.js similar to java-xmlbuilder.

License NPM Version NPM Downloads

Travis Build Status AppVeyor Build status Dev Dependency Status Code Coverage

Announcing xmlbuilder2:

The new release of xmlbuilder is available at xmlbuilder2! xmlbuilder2 has been redesigned from the ground up to be fully conforming to the modern DOM specification. It supports XML namespaces, provides built-in converters for multiple formats, collection functions, and more. Please see upgrading from xmlbuilder in the wiki.

New development will be focused towards xmlbuilder2; xmlbuilder will only receive critical bug fixes.

Installation:

npm install xmlbuilder

Usage:

var builder = require('xmlbuilder');

var xml = builder.create('root')
  .ele('xmlbuilder')
    .ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git')
  .end({ pretty: true});

console.log(xml);

will result in:

<?xml version="1.0"?>
<root>
  <xmlbuilder>
    <repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>
  </xmlbuilder>
</root>

It is also possible to convert objects into nodes:

var builder = require('xmlbuilder');

var obj = {
  root: {
    xmlbuilder: {
      repo: {
        '@type': 'git', // attributes start with @
        '#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // text node
      }
    }
  }
};

var xml = builder.create(obj).end({ pretty: true});
console.log(xml);

If you need to do some processing:

var builder = require('xmlbuilder');

var root = builder.create('squares');
root.com('f(x) = x^2');
for(var i = 1; i <= 5; i++)
{
  var item = root.ele('data');
  item.att('x', i);
  item.att('y', i * i);
}

var xml = root.end({ pretty: true});
console.log(xml);

This will result in:

<?xml version="1.0"?>
<squares>
  <!-- f(x) = x^2 -->
  <data x="1" y="1"/>
  <data x="2" y="4"/>
  <data x="3" y="9"/>
  <data x="4" y="16"/>
  <data x="5" y="25"/>
</squares>

See the wiki for details and examples for more complex examples.

xml2jsplistreact-native-bluetooth2killi8n-react-native-fast-imageofficegen-plusrtr-xmlrpcjest-html-reporter-chunghee-versionjest-html-reporter-projest-html-reporter-xrn-send-smssfdx-plugin-psafake-data-markersfake-marker-simulatormoodle-player@oneplanetcrowd/developersaliyun-sls-absolutegq-tour-transformerbillet-precalculationreact-native-template-rfbase@niklasz/jspurefix-fork@niklasz-org/jspurefix-forkairscanairscan-examplereact-native-esc-pos-sahaab@borisovart/atol-kkt-moduleclassactua-theme-addondeneme323112userfixsdkgradver@zervice/zervice-sfdx-core@ntt_app/react-native-custom-notification@restify-ts/pluginsreact-native-custom-text-hwjamesnotzer.ntz2icmlreact-native-covid-sdkmina-syskarma-trx-custom-reporterkarma-custom-trx-reporter@prime-dev/prime-sitemap-middlewareswemo-hackreact-native-thanh-toast-library@thanhnguyen14797/react-native-thanh-toast-librarytap-xunit-alsatianreact-native-printer-brothersrn-pdf-reader-offline@h2security/cdxgenreact-native-shekhar-bridge-testukor-remastervigor-aws-sdkwilscanner@oiti/documentoscopy-react-nativereact-native-slider-kftest-at-workhomelike-feed-processor@synatic/strong-soapofficegen-docx-tableandrew-samltestnpm_lmntestopenapi2apigeetina-node-metaverseuniterm-nodeunmock-jestunique-wallpapertypeorm-polymorphic-clonetestem-gitlab-reportertv-automation-mos-connectiontslint-formatterstsugi-node-ltitsugi-node-lti-tmptwilio-travoltrontwilioubl-builderubl-builder2ubltr-buildertypescript-xunit-xmltypesense-sitemaptwitter-friends-blog-rssviber-botkitsus-2-imagesvg-identiconsvg-icon-fetcher-webpack-pluginsvgutilssvg-to-jsxsvg-sprite-standardizedsuper-simple-sitemap-generatorswanleap-msexcel-builderswagger2apitmp-cypress-sonarqube-reportertanngotap-bambootap-xunittap-xunit-circlecitap-xunit-testname-ctrlcharstap-nunittcs-endpointstcurdt-xstatictessel-logotessel-logo-generatortheendsoaper
15.1.1

3 years ago

15.1.0

4 years ago

15.0.0

4 years ago

14.0.0

4 years ago

13.0.2

4 years ago

13.0.1

4 years ago

13.0.0

4 years ago

12.0.1

4 years ago

12.0.0

5 years ago

11.0.1

5 years ago

11.0.0

5 years ago

10.1.1

5 years ago

10.1.0

5 years ago

10.0.0

5 years ago

9.0.7

6 years ago

9.0.6

6 years ago

9.0.5

6 years ago

9.0.4

6 years ago

9.0.3

6 years ago

9.0.2

6 years ago

9.0.1

6 years ago

9.0.0

6 years ago

8.2.2

7 years ago

8.2.1

7 years ago

8.2.0

8 years ago

8.1.0

8 years ago

8.0.0

8 years ago

7.0.0

8 years ago

6.0.0

8 years ago

5.0.1

8 years ago

5.0.0

8 years ago

4.2.1

8 years ago

4.2.0

8 years ago

4.1.0

8 years ago

4.0.0

8 years ago

3.1.0

8 years ago

3.0.0

8 years ago

2.6.5

8 years ago

2.6.4

8 years ago

2.6.3

8 years ago

2.6.2

9 years ago

2.6.1

9 years ago

2.6.0

9 years ago

2.5.2

9 years ago

2.5.1

9 years ago

2.5.0

9 years ago

2.4.6

9 years ago

2.4.5

9 years ago

2.4.4

9 years ago

2.4.3

9 years ago

2.4.2

9 years ago

2.4.1

9 years ago

2.4.0

9 years ago

2.3.0

9 years ago

2.2.1

9 years ago

2.1.0

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.4.3

10 years ago

0.4.2

11 years ago

0.4.1

11 years ago

0.4.0

11 years ago

0.3.11

11 years ago

0.3.10

11 years ago

0.3.9

11 years ago

0.3.8

11 years ago

0.3.7

11 years ago

0.3.6

11 years ago

0.3.5

11 years ago

0.3.4

11 years ago

0.3.3

11 years ago

0.3.2

11 years ago

0.3.1

12 years ago

0.3.0

12 years ago

0.2.2

12 years ago

0.2.1

12 years ago

0.2.0

12 years ago

0.1.8

12 years ago

0.1.7

12 years ago

0.1.6

12 years ago

0.1.5

12 years ago

0.1.4

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago

0.0.6

13 years ago

0.0.5

13 years ago

0.0.4

13 years ago

0.0.3

13 years ago

0.0.2

13 years ago

0.0.1

13 years ago