Exemple #1
0
        private NvdlAnyNamespace ReadAnyNamespace()
        {
            NvdlAnyNamespace el = new NvdlAnyNamespace();

            FillLocation(el);
            el.Match = ParseMatch(reader.GetAttribute("match"));
            FillForeignAttribute(el);
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return(el);
            }
            reader.Read();
            do
            {
                reader.MoveToContent();
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                if (reader.NamespaceURI != Nvdl.Namespace)
                {
                    el.Foreign.Add(XDocument.ReadFrom(reader));
                    continue;
                }
                ReadAction(el);
            } while (!reader.EOF);
            if (!reader.EOF)
            {
                reader.Read();
            }
            return(el);
        }
Exemple #2
0
        internal void SimplifyPhase2(NvdlCompileContext ctx)
        {
            ArrayList al = new ArrayList();

            ConsumeIncludes(al, ctx);
            SimpleRule anyElement   = null;
            SimpleRule anyAttribute = null;

            // 6.4.12 + part of 6.4.13
            CheckCollision(al, ref anyElement, ref anyAttribute);
            // 6.4.13
            if (anyElement == null)
            {
                NvdlAnyNamespace ann = new NvdlAnyNamespace();
                ann.SourceUri    = this.SourceUri;
                ann.LineNumber   = this.LineNumber;
                ann.LinePosition = this.LinePosition;

                NvdlReject reject = new NvdlReject();
                reject.SourceUri    = this.SourceUri;
                reject.LineNumber   = this.LineNumber;
                reject.LinePosition = this.LinePosition;
                ann.Actions.Add(reject);
                ann.Match = NvdlRuleTarget.Elements;

                al.Add(new SimpleRule(ann, false, ctx));
            }
            if (anyAttribute == null)
            {
                NvdlAnyNamespace ann = new NvdlAnyNamespace();
                ann.SourceUri    = this.SourceUri;
                ann.LineNumber   = this.LineNumber;
                ann.LinePosition = this.LinePosition;

                NvdlAttach attach = new NvdlAttach();
                attach.SourceUri    = this.SourceUri;
                attach.LineNumber   = this.LineNumber;
                attach.LinePosition = this.LinePosition;
                ann.Match           = NvdlRuleTarget.Attributes;
                ann.Actions.Add(attach);

                al.Add(new SimpleRule(ann, true, ctx));
            }
            rules = (SimpleRule [])al.ToArray(typeof(SimpleRule));
        }
Exemple #3
0
		private NvdlAnyNamespace ReadAnyNamespace ()
		{
			NvdlAnyNamespace el = new NvdlAnyNamespace ();
			FillLocation (el);
			el.Match = ParseMatch (reader.GetAttribute ("match"));
			FillForeignAttribute (el);
			if (reader.IsEmptyElement) {
				reader.Skip ();
				return el;
			}
			reader.Read ();
			do {
				reader.MoveToContent ();
				if (reader.NodeType == XmlNodeType.EndElement)
					break;
				if (reader.NamespaceURI != Nvdl.Namespace) {
					el.Foreign.Add (doc.ReadNode (reader));
					continue;
				}
				ReadAction (el);
			} while (!reader.EOF);
			if (!reader.EOF)
				reader.Read ();
			return el;
		}
Exemple #4
0
		internal void SimplifyPhase2 (NvdlCompileContext ctx)
		{
			ArrayList al = new ArrayList ();
			ConsumeIncludes (al, ctx);
			SimpleRule anyElement = null;
			SimpleRule anyAttribute = null;
			// 6.4.12 + part of 6.4.13
			CheckCollision (al, ref anyElement, ref anyAttribute);
			// 6.4.13
			if (anyElement == null) {
				NvdlAnyNamespace ann = new NvdlAnyNamespace ();
				ann.SourceUri = this.SourceUri;
				ann.LineNumber = this.LineNumber;
				ann.LinePosition = this.LinePosition;

				NvdlReject reject = new NvdlReject ();
				reject.SourceUri = this.SourceUri;
				reject.LineNumber = this.LineNumber;
				reject.LinePosition = this.LinePosition;
				ann.Actions.Add (reject);
				ann.Match = NvdlRuleTarget.Elements;

				al.Add (new SimpleRule (ann, false, ctx));
			}
			if (anyAttribute == null) {
				NvdlAnyNamespace ann = new NvdlAnyNamespace ();
				ann.SourceUri = this.SourceUri;
				ann.LineNumber = this.LineNumber;
				ann.LinePosition = this.LinePosition;

				NvdlAttach attach = new NvdlAttach ();
				attach.SourceUri = this.SourceUri;
				attach.LineNumber = this.LineNumber;
				attach.LinePosition = this.LinePosition;
				ann.Match = NvdlRuleTarget.Attributes;
				ann.Actions.Add (attach);

				al.Add (new SimpleRule (ann, true, ctx));
			}
			rules = (SimpleRule []) al.ToArray (typeof (SimpleRule));
		}