コード例 #1
0
        static void GetNameClassRepresentatives(
            RdpNameClass n, Hashtable names)
        {
            if (n is RdpAnyName)
            {
                names [illegalQName] = illegalQName;
                return;
            }
            RdpAnyNameExcept exc = n as RdpAnyNameExcept;

            if (exc != null)
            {
                GetNameClassRepresentatives(exc.ExceptNameClass, names);
                names [illegalQName] = illegalQName;
                return;
            }
            RdpNsName ns = n as RdpNsName;

            if (ns != null)
            {
                QName nn = new QName(String.Empty, ns.NamespaceURI);
                names [nn] = nn;
                return;
            }
            RdpNsNameExcept nse = n as RdpNsNameExcept;

            if (nse != null)
            {
                GetNameClassRepresentatives(nse.ExceptNameClass, names);
                QName nn = new QName(String.Empty, nse.NamespaceURI);
                names [nn] = nn;
                return;
            }
            RdpName name = n as RdpName;

            if (name != null)
            {
                QName qname = new QName(name.LocalName, name.NamespaceURI);
                names [qname] = qname;
                return;
            }
            else
            {
                RdpNameClassChoice c = (RdpNameClassChoice)n;
                GetNameClassRepresentatives(c.LValue, names);
                GetNameClassRepresentatives(c.RValue, names);
                return;
            }
        }
コード例 #2
0
        // Generating simplified pattern status (similar to XML representation).
        #region Debug
        private static string DebugNameClass(RdpNameClass n)
        {
            switch (n.NameClassType)
            {
            case RdpNameClassType.Name:
                RdpName nm = (RdpName)n;
                return("<name ns='" + nm.NamespaceURI + "'>"
                       + nm.LocalName + "</name>\n");

            case RdpNameClassType.NsName:
                return("<nsName ns='" + ((RdpNsName)n).NamespaceURI + "'/>\n");

            case RdpNameClassType.NameClassChoice:
                RdpNameClassChoice nc = (RdpNameClassChoice)n;
                return("<choice>" + DebugNameClass(nc.LValue) + DebugNameClass(nc.RValue) + "</choice>");

            default:
                return("<" + n.NameClassType.ToString() + "/>\n");
            }
        }
コード例 #3
0
        static void GetNameClassRepresentatives(
            RdpNameClass n, IList <QName> names)
        {
            if (n is RdpAnyName)
            {
                if (!names.Contains(illegalQName))
                {
                    names.Add(illegalQName);
                }
                return;
            }
            RdpAnyNameExcept exc = n as RdpAnyNameExcept;

            if (exc != null)
            {
                GetNameClassRepresentatives(exc.ExceptNameClass, names);
                if (!names.Contains(illegalQName))
                {
                    names.Add(illegalQName);
                }
                return;
            }
            RdpNsName ns = n as RdpNsName;

            if (ns != null)
            {
                QName nn = new QName(String.Empty, ns.NamespaceURI);
                if (!names.Contains(nn))
                {
                    names.Add(nn);
                }
                return;
            }
            RdpNsNameExcept nse = n as RdpNsNameExcept;

            if (nse != null)
            {
                GetNameClassRepresentatives(nse.ExceptNameClass, names);
                QName nn = new QName(String.Empty, nse.NamespaceURI);
                if (!names.Contains(nn))
                {
                    names.Add(nn);
                }
                return;
            }
            RdpName name = n as RdpName;

            if (name != null)
            {
                QName qname = new QName(name.LocalName, name.NamespaceURI);
                if (!names.Contains(qname))
                {
                    names.Add(qname);
                }
                return;
            }
            else
            {
                RdpNameClassChoice c = (RdpNameClassChoice)n;
                GetNameClassRepresentatives(c.LValue, names);
                GetNameClassRepresentatives(c.RValue, names);
                return;
            }
        }