New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

gexode

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gexode

Primitive XML generator for node.js

latest
Source
npmnpm
Version
3.0.2
Version published
Weekly downloads
18
-14.29%
Maintainers
1
Weekly downloads
 
Created
Source

NPM version Build Status Dependency Status

gexode

Primitive XML generator for node.js

Example

const { doc, elem } = require(gexode);
const car = doc(elem('car', {wheels: 4}).text('Volvo'));
car.toString();

renders as:

<?xml version='1.0' encoding='UTF-8'?>
<car wheels='4'>Volvo</car>

Generator mode

gexode can also be used as a generator

import { generator } from 'gexode';

const { header, start, el, end } = generator({ pretty: true });

function* cars() {
  yield* header();
  yield* start('cars');
  yield* el('car', { wheels: 4 }, 'Volvo');
  yield* end();
}

Array.from(cars()).join('');

renders as:

<?xml version='1.0' encoding='UTF-8'?>
<cars>
  <car wheels='4'>Volvo</car>
</cars>

API

generator(options)

  • options - { pretty, selfClosing } if pretty is truthy intendations are generate if selfClosing is truthy empty tags are self closeing <likeThis/>

  • header - generate XML header

  • el(name, attribute, text)- generate a node with attributes (optional) and text (optional), close the node automatically

  • start(name, attribute)- like el but do not close the node

  • end - close recently opened node

License

MIT

Keywords

xml

FAQs

Package last updated on 27 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts