1 // Author: Dwivedi, Ajay kumar
\r
4 using System.Xml.Serialization;
\r
7 namespace System.Xml.Schema
\r
10 /// Summary description for XmlSchemaGroup.
\r
12 public class XmlSchemaGroup : XmlSchemaAnnotated
\r
14 private string name;
\r
15 private XmlSchemaGroupBase particle;
\r
16 private XmlQualifiedName qualifiedName;
\r
17 private int errorCount;
\r
19 public XmlSchemaGroup()
\r
23 [System.Xml.Serialization.XmlAttribute("name")]
\r
26 get{ return name; }
\r
27 set{ name = value; }
\r
30 [XmlElement("all",typeof(XmlSchemaAll),Namespace="http://www.w3.org/2001/XMLSchema")]
\r
31 [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
\r
32 [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
\r
33 public XmlSchemaGroupBase Particle
\r
35 get{ return particle; }
\r
36 set{ particle = value; }
\r
40 internal XmlQualifiedName QualifiedName
\r
42 get{ return qualifiedName;}
\r
45 // 1. name must be present
\r
47 internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
\r
50 error(h,"Required attribute name must be present");
\r
51 else if(!XmlSchemaUtil.CheckNCName(this.name))
\r
52 error(h,"attribute name must be NCName");
\r
54 qualifiedName = new XmlQualifiedName(Name,info.targetNS);
\r
56 if(Particle == null)
\r
58 error(h,"Particle is required");
\r
60 else if(Particle is XmlSchemaChoice)
\r
62 errorCount += ((XmlSchemaChoice)Particle).Compile(h,info);
\r
64 else if(Particle is XmlSchemaSequence)
\r
66 errorCount += ((XmlSchemaSequence)Particle).Compile(h,info);
\r
68 else if(Particle is XmlSchemaAll)
\r
70 errorCount += ((XmlSchemaAll)Particle).Compile(h,info);
\r
74 error(h,"only all,choice or sequence are allowed");
\r
77 if(this.Id != null && !XmlSchemaUtil.CheckID(Id))
\r
78 error(h, "id must be a valid ID");
\r
84 internal int Validate(ValidationEventHandler h)
\r
89 internal void error(ValidationEventHandler handle,string message)
\r
92 ValidationHandler.RaiseValidationError(handle,this,message);
\r