wasSharp – Diff between revs 7 and 26
?pathlinks?
Rev 7 | Rev 26 | |||
---|---|---|---|---|
Line 19... | Line 19... | |||
19 | { |
19 | { |
|
20 | private static readonly Func<string, bool> directIsSafeXML = |
20 | private static readonly Func<string, bool> directIsSafeXML = |
|
21 | ((Expression<Func<string, bool>>) |
21 | ((Expression<Func<string, bool>>) |
|
22 | (data => |
22 | (data => |
|
23 | Regex.Replace(data, |
23 | Regex.Replace(data, |
|
24 | @"(" + string.Join("|", @"&", @"<", @">", @""", @"'") + @")", |
24 | @"(" + string.Join(@"|", @"&", @"<", @">", @""", @"'") + @")", |
|
25 | @"", RegexOptions.IgnoreCase | RegexOptions.Multiline) |
25 | @"", RegexOptions.IgnoreCase | RegexOptions.Multiline) |
|
26 | .IndexOfAny(new[] {'&', '<', '>', '"', '\''}) |
26 | .IndexOfAny(new[] {'&', '<', '>', '"', '\''}) |
|
27 | .Equals(-1))).Compile(); |
27 | .Equals(-1))).Compile(); |
|
Line 28... | Line 28... | |||
28 | |
28 | |
|
Line 161... | Line 161... | |||
161 | /// <param name="root">the root from where to start</param> |
161 | /// <param name="root">the root from where to start</param> |
|
162 | /// <param name="name">the name to replace</param> |
162 | /// <param name="name">the name to replace</param> |
|
163 | /// <param name="rename">the name to replace with</param> |
163 | /// <param name="rename">the name to replace with</param> |
|
164 | public static void RenameNodes(XElement root, string name, string rename) |
164 | public static void RenameNodes(XElement root, string name, string rename) |
|
165 | { |
165 | { |
|
166 | if (Strings.StringEquals(root.Name.LocalName, name, StringComparison.Ordinal)) |
166 | if (String.Equals(root.Name.LocalName, name, StringComparison.Ordinal)) |
|
167 | { |
167 | { |
|
168 | root.Name = rename; |
168 | root.Name = rename; |
|
169 | } |
169 | } |
|
Line 170... | Line 170... | |||
170 | |
170 | |