illegal-xml-sanitizer

1.0.1 • Public • Published

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

/illegal-xml-sanitizer/

    Package Sidebar

    Install

    npm i illegal-xml-sanitizer

    Weekly Downloads

    8

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • stropho