npm.io
1.0.2 • Published 5 years ago

escape-xml

Licence
SEE LICENSE IN ./LICENSE
Version
1.0.2
Deps
0
Size
2 kB
Vulns
0
Weekly
0

Escape XML in javascript (NodeJS)

Escapes the invalid Markup characters: &, <, >, ", ' .

You could also always use CDATA escaping: <![CDATA[ .... ]]> especially with larger data.

npm install escape-xml


var xmlescape = require('escape-xml');
xmlescape(' Hello & Good Bye');

//return value
"Hello &amp; Good Bye"

If you also need to ignore some characters on purpose you can find a similar package here