15.1.1 • Published 4 years ago

xmlbuilder v15.1.1

Weekly downloads
14,839,565
License
MIT
Repository
github
Last release
4 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.

xml2jsplistcuc-gaf@panpress/clidecode-xlsxreact-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-samlthing-it-servervlocityvlocity-fix@everything-registry/sub-chunk-3186@bart.sk-ecommerce/node-pohodatea1-hyper-utiltea2-hyper-utildiscrete-overseer-creatorreact-native-responsive-sizedfeuk-frontend-manualpayutestingfi-studynew-hivefi-viewnew-hivefigma-reactfingerprintsfireglass-passport-samlfio-bank-payment-requestfg-passport-saml3.0.0@thinkeloquent/jest-html-reporter@tiledesk/tiledesk-vxml-connectorfluent-ssmlforimfda_submission_packagefiscal-printerfill-pdf-thaifill-pdf-utf8fhir2fhir2ccdag-contactsgabaritofree-depend14freedown-gysfreedog12freshbooks-api-clientfreshbooks-classicfreshbooks-legacyfriendly-czwfritzbox
15.1.1

4 years ago

15.1.0

4 years ago

15.0.0

4 years ago

14.0.0

4 years ago

13.0.2

5 years ago

13.0.1

5 years ago

13.0.0

5 years ago

12.0.1

5 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

6 years ago

10.0.0

6 years ago

9.0.7

6 years ago

9.0.6

6 years ago

9.0.5

6 years ago

9.0.4

7 years ago

9.0.3

7 years ago

9.0.2

7 years ago

9.0.1

7 years ago

9.0.0

7 years ago

8.2.2

8 years ago

8.2.1

8 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

9 years ago

3.0.0

9 years ago

2.6.5

9 years ago

2.6.4

9 years ago

2.6.3

9 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

10 years ago

2.4.3

10 years ago

2.4.2

10 years ago

2.4.1

10 years ago

2.4.0

10 years ago

2.3.0

10 years ago

2.2.1

10 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

12 years ago

0.4.1

12 years ago

0.4.0

12 years ago

0.3.11

12 years ago

0.3.10

12 years ago

0.3.9

12 years ago

0.3.8

12 years ago

0.3.7

12 years ago

0.3.6

12 years ago

0.3.5

12 years ago

0.3.4

12 years ago

0.3.3

12 years ago

0.3.2

12 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

13 years ago

0.1.4

13 years ago

0.1.3

13 years ago

0.1.2

13 years ago

0.1.1

13 years ago

0.1.0

13 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