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); }
public void WriteEmpty(RelaxngEmpty empty) { w.Write("empty "); }