RemoveNamespace() 개인적인 메소드

private RemoveNamespace ( string tns ) : void
tns string
리턴 void
예제 #1
0
        public static NamespaceList Intersection(NamespaceList o1, NamespaceList o2, bool v1Compat)
        {
            NamespaceList nslist = null;

            Debug.Assert(o1 != o2);      //clause 1
            if (o1.type == ListType.Any) //clause 2 - o1 is any
            {
                nslist = o2.Clone();
            }
            else if (o2.type == ListType.Any)   //clause 2 - o2 is any
            {
                nslist = o1.Clone();
            }
            else if (o1.type == ListType.Set && o2.type == ListType.Other)   //Clause 3 o2 is other
            {
                nslist = o1.Clone();
                nslist.RemoveNamespace(o2.targetNamespace);
                if (!v1Compat)
                {
                    nslist.RemoveNamespace(string.Empty); //remove ##local
                }
            }
            else if (o1.type == ListType.Other && o2.type == ListType.Set)   //Clause 3 o1 is other
            {
                nslist = o2.Clone();
                nslist.RemoveNamespace(o1.targetNamespace);
                if (!v1Compat)
                {
                    nslist.RemoveNamespace(string.Empty); //remove ##local
                }
            }
            else if (o1.type == ListType.Set && o2.type == ListType.Set)   //clause 4
            {
                nslist      = o1.Clone();
                nslist      = new NamespaceList();
                nslist.type = ListType.Set;
                nslist.set  = new Hashtable();
                foreach (string ns in o1.set.Keys)
                {
                    if (o2.set.Contains(ns))
                    {
                        nslist.set.Add(ns, ns);
                    }
                }
            }
            else if (o1.type == ListType.Other && o2.type == ListType.Other)
            {
                if (o1.targetNamespace == o2.targetNamespace)   //negation of same namespace name
                {
                    nslist = o1.Clone();
                    return(nslist);
                }
                if (!v1Compat)
                {
                    if (o1.targetNamespace == string.Empty)   // clause 6 - o1 is negation of absent
                    {
                        nslist = o2.Clone();
                    }
                    else if (o2.targetNamespace == string.Empty)   //clause 6 - o1 is negation of absent
                    {
                        nslist = o1.Clone();
                    }
                }
                //if it comes here, its not expressible //clause 5
            }
            return(nslist);
        }
예제 #2
0
        public static NamespaceList Intersection(NamespaceList o1, NamespaceList o2, bool v1Compat)
        {
            NamespaceList list = null;

            if (o1.type == ListType.Any)
            {
                return(o2.Clone());
            }
            if (o2.type == ListType.Any)
            {
                return(o1.Clone());
            }
            if ((o1.type == ListType.Set) && (o2.type == ListType.Other))
            {
                list = o1.Clone();
                list.RemoveNamespace(o2.targetNamespace);
                if (!v1Compat)
                {
                    list.RemoveNamespace(string.Empty);
                }
                return(list);
            }
            if ((o1.type == ListType.Other) && (o2.type == ListType.Set))
            {
                list = o2.Clone();
                list.RemoveNamespace(o1.targetNamespace);
                if (!v1Compat)
                {
                    list.RemoveNamespace(string.Empty);
                }
                return(list);
            }
            if ((o1.type == ListType.Set) && (o2.type == ListType.Set))
            {
                list = o1.Clone();
                list = new NamespaceList {
                    type = ListType.Set,
                    set  = new Hashtable()
                };
                foreach (string str in o1.set.Keys)
                {
                    if (o2.set.Contains(str))
                    {
                        list.set.Add(str, str);
                    }
                }
                return(list);
            }
            if ((o1.type == ListType.Other) && (o2.type == ListType.Other))
            {
                if (o1.targetNamespace == o2.targetNamespace)
                {
                    return(o1.Clone());
                }
                if (v1Compat)
                {
                    return(list);
                }
                if (o1.targetNamespace == string.Empty)
                {
                    return(o2.Clone());
                }
                if (o2.targetNamespace == string.Empty)
                {
                    list = o1.Clone();
                }
            }
            return(list);
        }