Documentation / @einvoice-ts/core / nonXmlChar
Function: nonXmlChar() ​
nonXmlChar(
value):number|undefined
Defined in: packages/core/src/xml-char.ts:31
The first code point of a string that XML 1.0 does not allow in a document, in element text and attribute values alike: a C0 control other than tab, line feed and carriage return, U+FFFE, U+FFFF, or a surrogate that is not half of a pair. No escape can write such a character, not even a character reference, so a value that holds one cannot be serialized.
Parameters ​
value ​
string
The text.
Returns ​
number | undefined
The offending code point, or undefined when every character is allowed.
Example ​
ts
import { nonXmlChar } from '@einvoice-ts/core';
nonXmlChar('Tab\tand line feed\n'); // undefined
nonXmlChar('Pasted from a PDF\u000C'); // 0x0c, a form feed
nonXmlChar('\uD83D'); // 0xd83d, half of a surrogate pair