コード例 #1
0
        public static IEnumerable <string> GetNodesPropertyValue(
            this XmlDocument document,
            string xpathArgument,
            string propertyValue,
            XmlNamespaceValue nsValue)
        {
            var list = document.SelectNodes(xpathArgument, nsValue.NsManager);

            return(list.Cast <XmlNode>().Select(x => x.Attributes[propertyValue].Value));
        }
コード例 #2
0
        public static string GetSingleNodeInnerText(
            this XmlDocument document,
            string xpathArgument,
            XmlNamespaceValue nsValue)
        {
            if (nsValue != null)
            {
                var node = document.SelectSingleNode(xpathArgument, nsValue.NsManager);

                return(node?.InnerText);
            }
            else
            {
                var node = document.SelectSingleNode(xpathArgument);
                return(node?.InnerText);
            }
        }