예제 #1
0
            public ValidationState AfterOpenStartTag(
                string localName, string ns)
            {
                RdpPattern p = state.StartTagOpenDeriv(
                    localName, ns);

                return(p is RdpNotAllowed ?
                       null : new ValidationState(p));
            }
예제 #2
0
        public void ElementStartTagOpenDeriv()
        {
            result = pattern1.StartTagOpenDeriv("bar", "urn:foo");
            AssertPattern("#element.start.1", RelaxngPatternType.NotAllowed, result);

            result = pattern1.StartTagOpenDeriv("foo", "urn:bar");
            AssertPattern("#element.start.2", RelaxngPatternType.NotAllowed, result);

            result = pattern1.StartTagOpenDeriv("foo", "urn:foo");
            AssertPattern("#element.start.3", RelaxngPatternType.After, result);
            RdpAfter after = result as RdpAfter;

            AssertPattern("#element.start.4", RelaxngPatternType.Empty, after.LValue);
            AssertPattern("#element.start.5", RelaxngPatternType.Empty, after.RValue);
        }
예제 #3
0
        public RdpPattern StartTagOpenDeriv(RdpPattern p, string local, string ns)
        {
            Hashtable h = startOpen [p] as Hashtable;

            if (h == null)
            {
                h             = new Hashtable();
                startOpen [p] = h;
            }
            XmlQualifiedName qn = GetQName(local, ns);
            RdpPattern       m  = h [qn] as RdpPattern;

            if (m == null)
            {
                m      = p.StartTagOpenDeriv(local, ns, this);
                h [qn] = m;
            }
            return(m);
        }
예제 #4
0
        public RdpPattern StartTagOpenDeriv(RdpPattern p, string local, string ns)
        {
            var h = startOpen.Get(p) as Dictionary <XmlQualifiedName, RdpPattern>;

            if (h == null)
            {
                h             = new Dictionary <XmlQualifiedName, RdpPattern> ();
                startOpen [p] = h;
            }
            XmlQualifiedName qn = GetQName(local, ns);
            RdpPattern       m  = h.Get(qn) as RdpPattern;

            if (m == null)
            {
                m      = p.StartTagOpenDeriv(local, ns, this);
                h [qn] = m;
            }
            return(m);
        }
예제 #5
0
        public ICollection GetElementLabels(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(elements.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 elements.Values)
            {
                if (p.StartTagOpenDeriv(qname.Name, qname.Namespace) is RdpNotAllowed)
                {
                    strictCheckCache.Add(qname);
                }
            }
            foreach (XmlQualifiedName qname in strictCheckCache)
            {
                elements.Remove(qname);
            }
            strictCheckCache.Clear();

            return(elements.Values);
        }
예제 #6
0
 // startTagOpenDeriv :: Pattern -> QName -> Pattern
 // TODO remains: Interleave, OneOrMore, Group, After
 internal static RdpPattern StartTagOpenDeriv(RdpPattern pattern, string name, string ns)
 {
     return(pattern.StartTagOpenDeriv(name, ns));
 }