File size: 791 Bytes
fab29d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.Xml.Linq;

namespace VersOne.Epub.Utils
{
    internal static class XmlExtensionMethods
    {
        public static string GetLowerCaseLocalName(this XElement xElement)
        {
            return xElement.Name.LocalName.ToLowerInvariant();
        }

        public static string GetLowerCaseLocalName(this XAttribute xAttribute)
        {
            return xAttribute.Name.LocalName.ToLowerInvariant();
        }

        public static bool CompareNameTo(this XElement xElement, string value)
        {
            return xElement.Name.LocalName.CompareOrdinalIgnoreCase(value);
        }

        public static bool CompareValueTo(this XAttribute xAttribute, string value)
        {
            return xAttribute.Value.CompareOrdinalIgnoreCase(value);
        }
    }
}