| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- // Author: Dwivedi, Ajay kumar
- // [email protected]
- using System;
- using System.Xml.Serialization;
- using System.Xml;
- namespace System.Xml.Schema
- {
- /// <summary>
- /// Summary description for XmlSchemaGroup.
- /// </summary>
- public class XmlSchemaGroup : XmlSchemaAnnotated
- {
- private string name;
- private XmlSchemaGroupBase particle;
- private XmlQualifiedName qualifiedName;
- private int errorCount;
- public XmlSchemaGroup()
- {
- }
- [System.Xml.Serialization.XmlAttribute("name")]
- public string Name
- {
- get{ return name; }
- set{ name = value; }
- }
- [XmlElement("all",typeof(XmlSchemaAll),Namespace="http://www.w3.org/2001/XMLSchema")]
- [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
- [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
- public XmlSchemaGroupBase Particle
- {
- get{ return particle; }
- set{ particle = value; }
- }
- [XmlIgnore]
- internal XmlQualifiedName QualifiedName
- {
- get{ return qualifiedName;}
- }
- // 1. name must be present
- [MonoTODO]
- internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)
- {
- if(Name == null)
- error(h,"Required attribute name must be present");
- else if(!XmlSchemaUtil.CheckNCName(this.name))
- error(h,"attribute name must be NCName");
- else
- qualifiedName = new XmlQualifiedName(Name,info.targetNS);
-
- if(Particle == null)
- {
- error(h,"Particle is required");
- }
- else if(Particle is XmlSchemaChoice)
- {
- errorCount += ((XmlSchemaChoice)Particle).Compile(h,info);
- }
- else if(Particle is XmlSchemaSequence)
- {
- errorCount += ((XmlSchemaSequence)Particle).Compile(h,info);
- }
- else if(Particle is XmlSchemaAll)
- {
- errorCount += ((XmlSchemaAll)Particle).Compile(h,info);
- }
- else
- {
- error(h,"only all,choice or sequence are allowed");
- }
- if(this.Id != null && !XmlSchemaUtil.CheckID(Id))
- error(h, "id must be a valid ID");
- return errorCount;
- }
-
- [MonoTODO]
- internal int Validate(ValidationEventHandler h)
- {
- return errorCount;
- }
-
- internal void error(ValidationEventHandler handle,string message)
- {
- errorCount++;
- ValidationHandler.RaiseValidationError(handle,this,message);
- }
- }
- }
|