// Same as GetSelfOrNewNavigator, but also verifies that the result is parked on an element node.
        private static XPathNavigator GetSelfOrNewElementNavigator(this IXPathNavigable element, string paramName = "element")
        {
            var nav = element.GetSelfOrNewNavigator(paramName);

            if (nav.NodeType != XPathNodeType.Element)
            {
                throw new ArgumentException("Operation not valid on non-element node (" + nav.NodeType.ToString() + ")", paramName);
            }
            return(nav);
        }