Socket
Book a DemoInstallSign in
Socket

illegal-xml-sanitizer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

illegal-xml-sanitizer

Replace illegal XML characters from text content

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
31
-13.89%
Maintainers
1
Weekly downloads
 
Created
Source

Removes/replaces invalid XML chracters from strings

Motivation

In case you process data from unknown sources (like the internet) and you want to generate XML files with that data, let's say XLSX files, you need to sanize the input data. Otherwise you XML parser (the program that opens and nicely displayes XML files data) will most probably crash.

Usage

var xmlSanitize = require('');
//replace invalid characters by empty string
xmlSanitize("\uFFFFab", ''); // "ab"

//empty string is a default value so you could write just:
xmlSanitize("\uFFFFab"); // "ab"

Note, that if a surrogate pair character (\uD800-\uDFFF) is found, the following character is removed as well

Keywords

xml

FAQs

Package last updated on 24 Sep 2017

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.