コード例 #1
0
        private NvdlNamespace ReadNamespace()
        {
            NvdlNamespace el = new NvdlNamespace();

            FillLocation(el);
            el.NS       = reader.GetAttribute("ns");
            el.Wildcard = reader.GetAttribute("wildCard");
            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);
        }
コード例 #2
0
ファイル: NvdlSimplified.cs プロジェクト: pmq20/mono_forked
        public SimpleRule(NvdlRule rule, bool matchAttributes,
                          NvdlCompileContext ctx)
        {
            FillLocation(rule);

            this.matchAttributes = matchAttributes;
            NvdlNamespace nss = rule as NvdlNamespace;

            if (nss == null)
            {
                this.isAny = true;
            }
            else
            {
                this.ns = nss.NS;
                if (nss.Wildcard == null)
                {
                    wildcard = "*";
                }
                else if (nss.Wildcard.Length > 1)
                {
                    throw new NvdlCompileException("'wildCard' attribute can specify at most one character string.", rule);
                }
                else
                {
                    wildcard = nss.Wildcard;
                }
            }

            SimplifyPhase1(rule, ctx);
        }
コード例 #3
0
ファイル: NvdlReader.cs プロジェクト: KonajuGames/SharpLang
		private NvdlNamespace ReadNamespace ()
		{
			NvdlNamespace el = new NvdlNamespace ();
			FillLocation (el);
			el.NS = reader.GetAttribute ("ns");
			el.Wildcard = reader.GetAttribute ("wildCard");
			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;
		}