Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# remove xml invalid characters

// remove xml invalid chars plus additioan replace for space and &
 static string RemoveInvalidXmlChars(string text)
        {
            var validXmlChars = text.Where(ch => XmlConvert.IsXmlChar(ch)).ToArray();
            return new string(validXmlChars).Replace(" ","").Replace("&","");
        }
 
PREVIOUS NEXT
Tagged: #remove #xml #invalid #characters
ADD COMMENT
Topic
Name
7+1 =