hdsdump.f4m.XmlNodeEx.GetChildNode(string)

Here are the examples of the csharp api class hdsdump.f4m.XmlNodeEx.GetChildNode(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

6 Examples 7

1. Example

Project: hdsdump
Source File: XMLex.cs
View license
public string GetText(string childNodeName) {
            XmlNode childNode = GetChildNode(childNodeName);
            if (childNode != null) {
                return childNode.InnerText.Trim();
            }
            return string.Empty;
        }

2. Example

Project: hdsdump
Source File: XMLex.cs
View license
public int GetChildNodeAttributeInt(string childNodeName, string attributeName, int defaultValue = 0) {
            int resultValue = defaultValue;
            XmlNode childNode = GetChildNode(childNodeName);
            if (childNode != null) {
                string strValue = childNode.Attributes?[attributeName]?.Value;
                int.TryParse(strValue, out resultValue);
            }
            return resultValue;
        }

3. Example

Project: hdsdump
Source File: XMLex.cs
View license
public byte[] GetData(string childNodeName) {
            XmlNode childNode = GetChildNode(childNodeName);
            if (childNode != null)
                return Convert.FromBase64String(childNode.InnerText.Trim());
            return null;
        }

4. Example

Project: hdsdump
Source File: XMLex.cs
View license
public int GetInt(string childNodeName, int defaultValue = 0) {
            int valueInt = defaultValue;
            XmlNode childNode = GetChildNode(childNodeName);
            if (childNode != null) {
                string val = childNode.InnerText.Trim();
                int.TryParse(val, out valueInt);
            }
            return valueInt;
        }

5. Example

Project: hdsdump
Source File: XMLex.cs
View license
public float GetFloat(string childNodeName, float defaultValue = 0) {
            float   valueInt  = defaultValue;
            XmlNode childNode = GetChildNode(childNodeName);
            if (childNode != null) {
                string val = childNode.InnerText.Trim();
                float.TryParse(val, out valueInt);
            }
            return valueInt;
        }

6. Example

Project: hdsdump
Source File: XMLex.cs
View license
public DateTime GetDateTime(string childNodeName) {
            XmlNode childNode = GetChildNode(childNodeName);
            DateTime result = new DateTime();
            if (childNode != null) {
                string val = childNode.InnerText.Trim();
                DateTime.TryParseExact(val, Rfc3339, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AssumeUniversal, out result);
            }
            return result;
        }