query
On this page

escapeXML

lib.strings.escapeXML

Docs pulled from | This Revision | 14 minutes ago


Escapes a string s such that it is safe to include verbatim in an XML document.

Inputs

s
1. Function argument

Type

escapeXML :: string -> string

Examples

lib.strings.escapeXML usage example

escapeXML ''"test" 'test' < & >''
=> "&quot;test&quot; &apos;test&apos; &lt; &amp; &gt;"

Noogle detected

Aliases

Implementation

This function is implemented in c++ and is part of the native nix runtime.

Implementation

The following is the current implementation of this function.

escapeXML = builtins.replaceStrings
    ["\"" "'" "<" ">" "&"]
    ["&quot;" "&apos;" "&lt;" "&gt;" "&amp;"];