Esempio n. 1
0
        public ICollection GetAttributeLabels(object stateObject)
        {
            ValidationState state      = ToState(stateObject);
            RdpPattern      p          = state.Pattern;
            Hashtable       elements   = new Hashtable();
            Hashtable       attributes = new Hashtable();

            p.GetLabels(elements, attributes);

            if (roughLabelCheck)
            {
                return(attributes.Values);
            }

            // Strict check that tries actual validation that will
            // cover rejection by notAllowed.
            if (strictCheckCache == null)
            {
                strictCheckCache = new ArrayList();
            }
            else
            {
                strictCheckCache.Clear();
            }
            foreach (XmlQualifiedName qname in attributes.Values)
            {
                if (p.AttDeriv(qname.Name, qname.Namespace, null, this) is RdpNotAllowed)
                {
                    strictCheckCache.Add(qname);
                }
            }
            foreach (XmlQualifiedName qname in strictCheckCache)
            {
                attributes.Remove(qname);
            }
            strictCheckCache.Clear();

            return(attributes.Values);
        }
Esempio n. 2
0
        public IEnumerable <XmlQualifiedName> GetElementLabels(object stateObject)
        {
            ValidationState state      = ToState(stateObject);
            RdpPattern      p          = state.Pattern;
            var             elements   = new List <XmlQualifiedName> ();
            var             attributes = new List <XmlQualifiedName> ();

            p.GetLabels(elements, attributes);

            if (roughLabelCheck)
            {
                return(elements);
            }

            // Strict check that tries actual validation that will
            // cover rejection by notAllowed.
            if (strictCheckCache == null)
            {
                strictCheckCache = new List <XmlQualifiedName> ();
            }
            else
            {
                strictCheckCache.Clear();
            }
            foreach (var qname in elements)
            {
                if (p.StartTagOpenDeriv(qname.Name, qname.Namespace) is RdpNotAllowed)
                {
                    strictCheckCache.Add(qname);
                }
            }
            foreach (var qname in strictCheckCache)
            {
                elements.Remove(qname);
            }
            strictCheckCache.Clear();

            return(elements);
        }