1 // Author: Dwivedi, Ajay kumar
\r
4 using System.Xml.Serialization;
\r
6 namespace System.Xml.Schema
\r
9 /// Summary description for XmlSchemaParticle.
\r
11 public abstract class XmlSchemaParticle : XmlSchemaAnnotated
\r
13 decimal minOccurs, maxOccurs;
\r
14 string minstr, maxstr;
\r
15 static XmlSchemaParticle empty;
\r
17 internal static XmlSchemaParticle Empty {
\r
19 if (empty == null) {
\r
20 empty = new XmlSchemaParticleEmpty ();
\r
26 protected XmlSchemaParticle()
\r
28 minOccurs = decimal.One;
\r
29 maxOccurs = decimal.One;
\r
34 [System.Xml.Serialization.XmlAttribute("minOccurs")]
\r
35 public string MinOccursString
\r
37 get{ return minstr; }
\r
40 decimal val = decimal.Parse(value);
\r
41 if(val >= 0 && (val == Decimal.Truncate(val)))
\r
44 minstr = val.ToString();
\r
48 throw new XmlSchemaException
\r
49 ("MinOccursString must be a non-negative number",null);
\r
54 [System.Xml.Serialization.XmlAttribute("maxOccurs")]
\r
55 public string MaxOccursString
\r
57 get{ return maxstr; }
\r
60 if(value == "unbounded")
\r
63 maxOccurs = decimal.MaxValue;
\r
67 decimal val = decimal.Parse(value);
\r
68 if(val >= 0 && (val == Decimal.Truncate(val)))
\r
71 maxstr = val.ToString();
\r
75 throw new XmlSchemaException
\r
76 ("MaxOccurs must be a non-negative integer",null);
\r
87 public decimal MinOccurs
\r
89 get{ return minOccurs; }
\r
92 MinOccursString = value.ToString();
\r
97 public decimal MaxOccurs
\r
99 get{ return maxOccurs; }
\r
102 MaxOccursString = value.ToString();
\r
108 #region Internal Class
\r
109 public class XmlSchemaParticleEmpty : XmlSchemaParticle
\r
111 internal XmlSchemaParticleEmpty ()
\r