diff --git a/ICD.Common.Utils/Xml/XmlReaderExtensions.cs b/ICD.Common.Utils/Xml/XmlReaderExtensions.cs
index fcf1ae7..60d26c6 100644
--- a/ICD.Common.Utils/Xml/XmlReaderExtensions.cs
+++ b/ICD.Common.Utils/Xml/XmlReaderExtensions.cs
@@ -382,6 +382,21 @@ namespace ICD.Common.Utils.Xml
return ushort.Parse(content);
}
+ ///
+ /// Parses the element content as a short.
+ ///
+ ///
+ ///
+ [PublicAPI]
+ public static short ReadElementContentAsShort(this IcdXmlReader extends)
+ {
+ if (extends == null)
+ throw new ArgumentNullException("extends");
+
+ string content = extends.ReadElementContentAsString();
+ return short.Parse(content);
+ }
+
///
/// Parses the element content as an enum.
///
diff --git a/ICD.Common.Utils/Xml/XmlUtils.cs b/ICD.Common.Utils/Xml/XmlUtils.cs
index 6caecd0..1119b0c 100644
--- a/ICD.Common.Utils/Xml/XmlUtils.cs
+++ b/ICD.Common.Utils/Xml/XmlUtils.cs
@@ -406,6 +406,19 @@ namespace ICD.Common.Utils.Xml
return reader.ReadElementContentAsUShort();
}
+ ///
+ /// Gets the content of an immediate child.
+ ///
+ ///
+ ///
+ ///
+ [PublicAPI]
+ public static short ReadChildElementContentAsShort(string xml, string childElement)
+ {
+ using (IcdXmlReader reader = GetChildElement(xml, childElement))
+ return reader.ReadElementContentAsShort();
+ }
+
///
/// Gets the content of an immediate child.
///
@@ -566,6 +579,25 @@ namespace ICD.Common.Utils.Xml
}
}
+ ///
+ /// Gets the content of the immediate child. Returns null if the child element was not found.
+ ///
+ ///
+ ///
+ ///
+ [PublicAPI]
+ public static short? TryReadChildElementContentAsShort(string xml, string childElement)
+ {
+ try
+ {
+ return ReadChildElementContentAsShort(xml, childElement);
+ }
+ catch (FormatException)
+ {
+ return null;
+ }
+ }
+
///
/// Gets the content of the immediate child. Returns null if the child element was not found.
///