public static SelectorType GetSelectorType(string selector)
        {
            SelectorType sel = SelectorType.Unspecified;

            try
            {
                XPathExpression.Compile(selector);
                sel = SelectorType.Xpath;
            }
            catch (XPathException) { }

            try
            {
                var parser     = new StylesheetParser();
                var stylesheet = parser.ParseSelector(selector);
                if (stylesheet == null)
                {
                    throw new ArgumentException();
                }
                sel = SelectorType.Css;
            }
            catch (ArgumentException) { }

            return(sel);
        }