iTextSharp.text.xml.XMLUtil.UnescapeXML C# (CSharp) Method

UnescapeXML() public static method

public static UnescapeXML ( String s ) : String
s String
return String
        public static String UnescapeXML(String s)
        {
            char[] cc = s.ToCharArray();
            int len = cc.Length;
            StringBuilder sb = new StringBuilder();
            int pos;
            String esc;
            for (int i = 0; i < len; i++) {
                int c = cc[i];
                if (c == '&') {
                    pos = FindInArray(';', cc, i + 3);
                    if (pos > -1) {
                        esc = new String(cc, i + 1, pos - i - 1);
                        if (esc.StartsWith("#")) {
                            esc = esc.Substring(1);
                            if (IsValidCharacterValue(esc)) {
                                c = (char)int.Parse(esc);
                                i = pos;
                            } else {
                                i = pos;
                                continue;
                            }
                        }
                        else {
                            int tmp = Unescape(esc);
                            if (tmp > 0) {
                                c = tmp;
                                i = pos;
                            }
                        }
                    }
                }
                sb.Append((char)c);
            }
            return sb.ToString();
        }