Пример #1
0
        private RelaxngEmpty ReadEmptyPattern()
        {
            expect("empty");

            if (MoveToFirstAttribute())
            {
                do
                {
                    if (NamespaceURI == String.Empty && LocalName != "datatypeLibrary")
                    {
                        throw new RelaxngException("Invalid attribute.");
                    }
                } while (MoveToNextAttribute());
                MoveToElement();
            }

            if (!IsEmptyElement)
            {
                Read();
                expectEnd("empty");
            }
            else
            {
                Read();
            }

            RelaxngEmpty empty = new RelaxngEmpty();

            FillLocation(empty);
            return(empty);
        }
Пример #2
0
		private RelaxngEmpty ReadEmptyPattern ()
		{
			expect ("empty");

			if (MoveToFirstAttribute ()) {
				do {
					if (NamespaceURI == String.Empty && LocalName != "datatypeLibrary")
						throw new RelaxngException ("Invalid attribute.");
				} while (MoveToNextAttribute ());
				MoveToElement ();
			}

			if (!IsEmptyElement) {
				Read ();
				expectEnd ("empty");
			}
			else
				Read ();

			RelaxngEmpty empty = new RelaxngEmpty ();
			FillLocation (empty);
			return empty;
		}
Пример #3
0
		RelaxngPattern CreateElement (XmlSchemaElement xse)
		{
			if (xse.RefName != XmlQualifiedName.Empty) {
				RelaxngRef r = new RelaxngRef ();
				r.Name = xse.RefName.Name;
				// namespace means nothing here.
				return r;
			}

			RelaxngElement re = new RelaxngElement ();
			RelaxngName name = new RelaxngName ();
			name.LocalName = xse.Name;
			re.NameClass = name;

			XmlSchemaComplexType ct = xse.SchemaType as XmlSchemaComplexType;

			foreach (XmlSchemaAttribute a in ct.Attributes)
				re.Patterns.Add (CreateAttribute (a));

			RelaxngPattern rpart;
			if (ct.Particle == null)
				rpart = new RelaxngEmpty ();
			else
				rpart = CreatePatternFromParticle (ct.Particle);

			if (ct.IsMixed) {
				if (rpart.PatternType != RelaxngPatternType.Empty) {
					RelaxngMixed mixed = new RelaxngMixed ();
					mixed.Patterns.Add (rpart);
					rpart = mixed;
				} else {
					rpart = new RelaxngText ();
				}
			}

			re.Patterns.Add (rpart);

			return re;
		}
Пример #4
0
		public void WriteEmpty (RelaxngEmpty empty)
		{
			w.Write ("empty ");
		}