示例#1
0
        static Exception _TryParse(string text, IHxlNamespaceResolver namespaceResolver, out HxlQualifiedName result)
        {
            result = null;

            if (text == null)
            {
                return(new ArgumentNullException("text"));
            }
            if (string.IsNullOrEmpty(text))
            {
                return(Failure.EmptyString("text"));
            }

            var helper = HxlQualifiedNameHelper.Parse(text);

            Uri ns = null;

            if (!string.IsNullOrEmpty(helper.Prefix))
            {
                ns = namespaceResolver.LookupNamespace(helper.Prefix);
            }

            result = helper.ToName(ns);
            return(null);
        }
示例#2
0
        public static HxlQualifiedName Parse(string text, IHxlNamespaceResolver namespaceResolver)
        {
            HxlQualifiedName result;
            Exception        ex = _TryParse(text, namespaceResolver, out result);

            if (ex == null)
            {
                return(result);
            }
            else
            {
                throw ex;
            }
        }
示例#3
0
        void SetResolver(IHxlNamespaceResolver resolver)
        {
            _settings.NodeFactories.SetResolver(resolver);

            var factories = _nodeFactory as IEnumerable <IDomNodeFactory>;

            if (factories != null)
            {
                foreach (var factory in factories.OfType <IHxlDomNodeFactory>())
                {
                    factory.SetResolver(resolver);
                }
            }
        }
        private static void SetResolver_(IEnumerable <IDomNodeFactory> items, IHxlNamespaceResolver resolver)
        {
            foreach (var m in items)
            {
                IHxlDomNodeFactory f = m as IHxlDomNodeFactory;
                if (f != null)
                {
                    f.SetResolver(resolver);
                    continue;
                }

                IEnumerable <IDomNodeFactory> composite = m as IEnumerable <IDomNodeFactory>;
                if (composite != null)
                {
                    SetResolver_(composite, resolver);
                }
            }
        }
示例#5
0
        // TODO CORP RULES requires that this be IServiceProvider

        public static bool TryParse(string text, IHxlNamespaceResolver namespaceResolver, out HxlQualifiedName result)
        {
            return(_TryParse(text, namespaceResolver, out result) == null);
        }
 internal void SetResolver(IHxlNamespaceResolver resolver)
 {
     SetResolver_(this, resolver);
 }