NanoXLSX.Reader 3.1.0
Loading...
Searching...
No Matches
ReaderUtils.cs
1/*
2* NanoXLSX is a small .NET library to generate and read XLSX (Microsoft Excel 2007 or newer) files in an easy and native way
3* Copyright Raphael Stoeckli © 2026
4* This library is licensed under the MIT License.
5* You find a copy of the license in project folder or on: http://opensource.org/licenses/MIT
6*/
7
8using System.Xml;
9
10namespace NanoXLSX.Internal
11{
15 public static class ReaderUtils
16 {
24 public static string GetAttribute(XmlNode node, string targetName, string fallbackValue = null)
25 {
26 if (node.Attributes == null || node.Attributes.Count == 0)
27 {
28 return fallbackValue;
29 }
30
31 foreach (XmlAttribute attribute in node.Attributes)
32 {
33 if (attribute.Name == targetName)
34 {
35 return attribute.Value;
36 }
37 }
38
39 return fallbackValue;
40 }
41 }
42}
Static class with common util methods, used during reading XLSX files.
static string GetAttribute(XmlNode node, string targetName, string fallbackValue=null)
Gets the XML attribute of the passed XML node by its name.