Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xmlcreate

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

xmlcreate

Simple XML builder for Node.js

  • 2.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is xmlcreate?

The xmlcreate npm package is a lightweight library for creating XML documents in a programmatic way. It provides a simple API to build XML structures, making it easy to generate XML content dynamically.

What are xmlcreate's main functionalities?

Creating XML Documents

This feature allows you to create a new XML document with a specified version and encoding. You can then add elements to the document, including nested elements.

const { document } = require('xmlcreate');
const doc = document({ version: '1.0', encoding: 'UTF-8' });
const root = doc.element({ name: 'root' });
root.element({ name: 'child', text: 'Hello, World!' });
console.log(doc.toString());

Adding Attributes to Elements

This feature allows you to add attributes to XML elements. In this example, an 'id' attribute is added to the 'child' element.

const { document } = require('xmlcreate');
const doc = document({ version: '1.0', encoding: 'UTF-8' });
const root = doc.element({ name: 'root' });
const child = root.element({ name: 'child', text: 'Hello, World!' });
child.attribute({ name: 'id', value: '1' });
console.log(doc.toString());

Pretty Printing XML

This feature allows you to output the XML document in a pretty-printed format, making it more readable.

const { document } = require('xmlcreate');
const doc = document({ version: '1.0', encoding: 'UTF-8' });
const root = doc.element({ name: 'root' });
root.element({ name: 'child', text: 'Hello, World!' });
console.log(doc.toString({ pretty: true }));

Other packages similar to xmlcreate

Keywords

FAQs

Package last updated on 30 Oct 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc