/// <summary>
 /// Add a child validation item.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="xpath"></param>
 /// <param name="children"></param>
 /// <param name="relative">Is the xpath relative to the child xpath</param>
 /// <returns></returns>
 public static XPathValidator AddChild(this XPathValidator item, string xpath, IList<IXPathValidator> children = null, bool relative = false)
 {
     if (relative)
     {
         xpath = item.XPath + "/" + xpath;
     }
     var child = new XPathValidator { XPath = xpath, Children = children };
     return item.AddChild(child);
 }
        /// <summary>
        /// Converts XPaths into validation items.
        /// </summary>
        /// <param name="xpaths"></param>
        /// <returns></returns>
        public static XPathValidator ToXPathValidator(this IEnumerable<string> xpaths)
        {
            // Make the parent the root node, should always exist
            var parent = new XPathValidator { XPath = "/" };

            foreach (var xpath in xpaths)
            {
                parent.AddChild(xpath);
            }

            return parent;
        }
示例#3
0
        /// <summary>
        /// Add a child validation item.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="xpath"></param>
        /// <param name="children"></param>
        /// <param name="relative">Is the xpath relative to the child xpath</param>
        /// <returns></returns>
        public static XPathValidator AddChild(this XPathValidator item, string xpath, IList <IXPathValidator> children = null, bool relative = false)
        {
            if (relative)
            {
                xpath = item.XPath + "/" + xpath;
            }
            var child = new XPathValidator {
                XPath = xpath, Children = children
            };

            return(item.AddChild(child));
        }
示例#4
0
        /// <summary>
        /// Converts XPaths into validation items.
        /// </summary>
        /// <param name="xpaths"></param>
        /// <returns></returns>
        public static XPathValidator ToXPathValidator(this IEnumerable <string> xpaths)
        {
            // Make the parent the root node, should always exist
            var parent = new XPathValidator {
                XPath = "/"
            };

            foreach (var xpath in xpaths)
            {
                parent.AddChild(xpath);
            }

            return(parent);
        }
        /// <summary>
        /// Add a child validation item.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="child"></param>
        /// <returns></returns>
        public static XPathValidator AddChild(this XPathValidator item, XPathValidator child)
        {
            item.Children.Add(child);

            return item;
        }
示例#6
0
        /// <summary>
        /// Add a child validation item.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="child"></param>
        /// <returns></returns>
        public static XPathValidator AddChild(this XPathValidator item, XPathValidator child)
        {
            item.Children.Add(child);

            return(item);
        }