private string BuildNamespace(Uri source, string xmlNamespace)
        {
            var key    = new NamespaceKey(source, xmlNamespace);
            var result = NamespaceProvider.FindNamespace(key);

            if (!string.IsNullOrEmpty(result))
            {
                return(result);
            }

            throw new Exception(string.Format("Namespace {0} not provided through map or generator.", xmlNamespace));
        }
Beispiel #2
0
        private NamespaceModel CreateNamespaceModel(Uri source, XmlQualifiedName qualifiedName)
        {
            NamespaceModel namespaceModel = null;

            if (!qualifiedName.IsEmpty && qualifiedName.Namespace != XmlSchema.Namespace)
            {
                var key = new NamespaceKey(source, qualifiedName.Namespace);
                if (!Namespaces.TryGetValue(key, out namespaceModel))
                {
                    var namespaceName = BuildNamespace(source, qualifiedName.Namespace);
                    namespaceModel = new NamespaceModel(key, _configuration)
                    {
                        Name = namespaceName
                    };
                    Namespaces.Add(key, namespaceModel);
                }
            }
            return(namespaceModel);
        }