26 public static string GetAttribute(XmlNode node,
string targetName,
string fallbackValue =
null)
28 if (node.Attributes ==
null || node.Attributes.Count == 0)
33 foreach (XmlAttribute attribute
in node.Attributes)
35 if (attribute.Name == targetName)
37 return attribute.Value;
53 public static bool GetAttributeOfChild(XmlNode node,
string childNodeName,
string attributeName, out
string output)
56 if (childNode !=
null)
73 if (node !=
null && node.HasChildNodes)
75 return node.ChildNodes.Cast<XmlNode>().FirstOrDefault(c => c.LocalName.Equals(name, StringComparison.OrdinalIgnoreCase));
86 internal static bool IsNode(XmlNode node,
string name)
88 return node.LocalName.Equals(name, StringComparison.OrdinalIgnoreCase);
97 internal static string DiscoverPrefix(XmlDocument document,
string targetName)
99 foreach (XmlNode node
in document.ChildNodes)
101 if (node.LocalName == targetName)
116 internal static XmlNodeList GetElementsByTagName(XmlDocument document,
string tagName,
string prefix)
118 if (
string.IsNullOrEmpty(prefix))
120 return document.GetElementsByTagName(tagName);
124 return document.GetElementsByTagName(prefix +
":" + tagName);
Static class with common util methods, used during reading XLSX files.
static XmlNode GetChildNode(XmlNode node, string name)
Gets the specified child node.
static string GetAttribute(XmlNode node, string targetName, string fallbackValue=null)
Gets the XML attribute of the passed XML node by its name.
static bool GetAttributeOfChild(XmlNode node, string childNodeName, string attributeName, out string output)
Gets the XML attribute from a child node of the passed XML node by its name and the name of the child...