RegEx to remove invalid XML characters
Posted on 2008-11-19
I am storing data collected on a website as xml in ms sql 2005.
some characters are not allowed and I recieve "XML parsing: line 3, character 27, illegal xml character"
I believe what happens is people type up information in MS word or a similar program that uses extended characters such as curly quotes. When I find an new illegal character I try and replace it. But doing each illegal character seems clunkly. I'm assuming there has to be a RegEx solution here.
Can anyone give me a vb.net example of a RegEx solution that will strip out all non legal XML characters as defined by MS SQL 2005.