Really handy, saved me writing one myself for my XML Importer in SSIS
MIT LICENSED
Ever get a System.Xml.XmlException that says:
“Hexadecimal value 0x[whatever] is an invalid character”
…when trying to load a XML document using one of the .NET XML API objects like XmlReader, XmlDocument, or XDocument? Was “0x[whatever]” by chance one of these characters?
0x00 0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x0B 0x0C
0x0E
0x0F
0x10 0x11
0x12
0x13
0x14
0x15
0x1A 0x1B
0x1C
0x1D
0x1E
0x1F
0x16
0x17
0x18
0x19
0x7F
The problem that causes these XmlExceptions is that the data being read or loaded contains characters that are illegal according to the XML specifications. Almost always, these characters are in the ASCII control character range (think whacky characters like null, bell, backspace, etc). These aren’t characters that have any business being in XML data; they’re illegal characters that should be removed, usually having found their way into the data from file format conversions, like when someone tries…
View original post 602 more words