getting this error when trying to parse an xml fee...
# general
b
getting this error when trying to parse an xml feed "An invalid XML character (Unicode: 0x2) was found in the element content of the document" how can i clean the xml content so that i can safely parse?
got the answer from ChatGPT and it worked
Copy code
var xmlString = "Your XML content with invalid characters";

// Replace invalid characters with an empty string
xmlString = xmlString.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, '');
The regular expression
/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g
matches and replaces all control characters (ASCII 0-8, 11, 12, 14-31, and 127).
🙌 1