UriTree: Introducing Songhay.Xml.XmlUtility
The image at right summarizes the static class
Songhay.Xml.XmlUtility
. UriTree depends heavily on this “helper” class. This definition instances the workhorse of all XML-related activities for Songhay System enterprise data solutions. The design goals include:
- Exploiting the System.Xml.XPath.IXPathNavigable interface. Use of this interface almost completely eliminates the boundary between
XmlDocument
andXPathDocument
. This reduces lines of code—especially when writing overloads that erroneously distinguish these types. In theSonghay.Xml.XmlUtility
definition, you will see members withIXPathNavigable XSet
among the arguments. - Leveraging .NET 2.0 Generics. The
GetInstance<T>(String XmlPath)
andGetInstanceRaw<T>(String XmlString)
members are generic de-serialization methods that are designed to handle all of the de-serialization tasks required by Songhay System solutions. Their featured use case is when an XML configuration file needs to be loaded from disk and instanced into a .NET type. - Centralizing
XPathDocument
“factory” code. Songhay System makes theXPathDocument
the premiere, .NET 2.0 XML data type. It follows that theXPathNavigator
is the premiere XML data set. We can find no near-fatal flaws with this Microsoft innovation! TheGetXpDoc()
,GetXpNode()
andGetXpNodes()
members ofSonghay.Xml.XmlUtility
express this sentiment. This ‘sentiment’ might be considered ridiculous for the seasoned, .NET 1.x, XML maven. This is because such experienced folk may have overlooked the sentence, “TheXPathNavigator
class has been updated to include editing capabilities…” in the MSDN documentation. - Centralizing all required XSL transformation scenarios. The new very, very fast XslCompiledTransform is featured in these members:
GetXslResult()
,GetXslString()
,LoadXslTransform()
andWriteXslTransform()
. - Centralizing namespace management for XPath queries. The
GetNamespaceManager()
members handle certain XPath node ‘resolution issues’ that are beyond the scope of this document.Our UriTree takes advantage of the ‘XPathDocument
factory code’ and the associated namespace routines inSonghay.Xml.XmlUtility
. This is a brief introduction of theSonghay.Xml.XmlUtility
. Going forward, certainly this topic will come up again as this “helper” class is fundamental to the Songhay System.