예제 #1
0
        private static NamespaceDeclarationCollection NamespaceDeclarations(
            IEnumerable <XNamespace> appeared, IReadOnlyNamespaceDeclarationCollection declared)
        {
            int n      = 0;
            var result = new List <NamespaceDeclaration>();

            appeared = Enumerable.Concat(
                new List <XNamespace> {
                Psf.Namespace, Psk.Namespace, Xsd.Namespace, Xsi.Namespace
            },
                appeared);

            foreach (var uri in appeared)
            {
                var prefix = declared.LookupPrefix(uri);
                if (prefix == null)
                {
                    prefix = string.Format("ns{0:0000}", n);
                    n     += 1;
                }

                result.Add(new NamespaceDeclaration(prefix, uri));
            }

            return(new NamespaceDeclarationCollection(result));
        }
예제 #2
0
        private static NamespaceDeclarationCollection NamespaceDeclarations(
            IEnumerable<XNamespace> appeared, IReadOnlyNamespaceDeclarationCollection declared)
        {
            int n = 0;
            var result = new List<NamespaceDeclaration>();

            appeared = Enumerable.Concat(
                new List<XNamespace> { Psf.Namespace, Psk.Namespace, Xsd.Namespace, Xsi.Namespace },
                appeared);

            foreach (var uri in appeared)
            {
                var prefix = declared.LookupPrefix(uri);
                if (prefix == null)
                {
                    prefix = string.Format("ns{0:0000}", n);
                    n += 1;
                }

                result.Add(new NamespaceDeclaration(prefix, uri));
            }

            return new NamespaceDeclarationCollection(result);
        }
예제 #3
0
 internal NamespaceResolver(IReadOnlyNamespaceDeclarationCollection namespaces)
 {
     NamespaceDeclarations = new NamespaceDeclarationCollection(namespaces);
 }
예제 #4
0
 internal NamespaceResolver(IReadOnlyNamespaceDeclarationCollection namespaces)
 {
     NamespaceDeclarations = new NamespaceDeclarationCollection(namespaces);
 }