We are running into an error about XML files containing invalid (hexadecimal) characters. What can we do about this? (NAV)

By pasting invalid data in the old Microsoft Dynamics NAV Windows client, it is possible to paste unprintable characters which should not be there. When fields containing these invalid characters are used in reports, then this might raise the following error during XML validation of the dataset:

A call to DocumentCreator.<MethodName> failed with this message: hexadecimal value <character>, is an invalid character. Line: <line no.>, position: <position no.>

You need to clean up the data in the table fields that contain invalid, unprintable characters, to prevent further issues in external systems and APIs that use these fields. By checking the contents of the XML dataset file on the specified position, you can pin down which field(s) contain(s) the error.