コード例 #1
0
        private RelaxngDefine ReadDefine()
        {
            RelaxngDefine def = new RelaxngDefine();

            FillLocation(def);
            expect("define");
            def.Name    = GetNameAttribute();
            def.Combine = GetSpaceStrippedAttribute("combine", String.Empty);

            Read();
            while (NodeType == XmlNodeType.Element)
            {
                def.Patterns.Add(ReadPattern());
            }
            expectEnd("define");
            return(def);
        }
コード例 #2
0
ファイル: RelaxngReader.cs プロジェクト: jack-pappas/mono
		private RelaxngDefine ReadDefine ()
		{
			RelaxngDefine def = new RelaxngDefine ();
			FillLocation (def);
			expect ("define");
			def.Name = GetNameAttribute ();
			def.Combine = GetSpaceStrippedAttribute ("combine", String.Empty);

			Read ();
			while (NodeType == XmlNodeType.Element)
				def.Patterns.Add (ReadPattern ());
			expectEnd ("define");
			return def;
		}
コード例 #3
0
ファイル: dtd2rng.cs プロジェクト: nobled/mono
		RelaxngDefine DefineElement (XmlSchemaElement el)
		{
			RelaxngDefine def = new RelaxngDefine ();
			def.Patterns.Add (CreateElement (el));
			def.Name = el.Name;

			return def;
		}
コード例 #4
0
ファイル: RncWriter.cs プロジェクト: runefs/Marvin
		// Note that it might not be used directly when a grammar
		// contains more than one "define" for an identical name
		// (compact syntax does not support "combine" attribute).
		public void WriteDefine (RelaxngDefine define)
		{
			if (IsKeyword (define.Name))
				w.Write ('\\');
			w.Write (define.Name);
			if (define.Combine == null)
				w.Write (" = ");
			else
				w.Write (define.Combine.Trim () == "interleave" ?
					" &= " : " |= ");
			if (define.Patterns.Count == 0)
				w.Write ("empty");
			else {
				define.Patterns [0].WriteRnc (this);
				for (int i = 1; i < define.Patterns.Count; i++) {
					w.Write (",");
					define.Patterns [i].WriteRnc (this);
				}
			}
			w.WriteLine ();
			w.WriteLine ();
		}
コード例 #5
0
		private RelaxngDefine CreateGlobalAttribute (QName name)
		{
			RelaxngDefine def = new RelaxngDefine ();
			def.Name = CreateUniqueName (name.Name + "-attr");
			RelaxngAttribute attr = new RelaxngAttribute ();
			attr.NameClass = new RelaxngName (
				name.Name, name.Namespace);
			def.Patterns.Add (attr);
			attributes.Add (name, def);
			grammar.Defines.Add (def);
			return def;
		}
コード例 #6
0
		// Already relaxed.
		private RelaxngDefine CreateGlobalElement (QName name)
		{
			RelaxngDefine def = new RelaxngDefine ();
			def.Name = CreateUniqueName (name.Name);
			RelaxngElement el = new RelaxngElement ();
			el.NameClass = new RelaxngName (name.Name,
				name.Namespace);
			def.Patterns.Add (el);
			elements.Add (name, def);
			grammar.Defines.Add (def);
			return def;
		}
コード例 #7
0
		private void InferElement (RelaxngDefine el, bool isNew)
		{
			RelaxngElement ct = (RelaxngElement) el.Patterns [0];

			// Attributes
			if (source.MoveToFirstAttribute ()) {
				InferAttributes (ct, isNew);
				source.MoveToElement ();
			}

			// Content
			if (source.IsEmptyElement) {
				InferAsEmptyElement (ct, isNew);
				source.Read ();
				source.MoveToContent ();
			}
			else {
				InferContent (ct, isNew);
				source.ReadEndElement ();
			}
			if (GetElementContent (ct) == null)
				el.Patterns.Add (new RelaxngEmpty ());
		}