| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- // Author: Dwivedi, Ajay kumar
- // [email protected]
- using System;
- using System.Xml.Serialization;
- namespace System.Xml.Schema
- {
- /// <summary>
- /// Summary description for XmlSchemaParticle.
- /// </summary>
- public abstract class XmlSchemaParticle : XmlSchemaAnnotated
- {
- decimal minOccurs, maxOccurs;
- string minstr, maxstr;
- protected XmlSchemaParticle()
- {
- minOccurs = decimal.One;
- maxOccurs = decimal.One;
- }
- #region Attributes
- [System.Xml.Serialization.XmlAttribute("maxOccurs")]
- public string MaxOccursString
- {
- get{ return maxstr; }
- set
- {
- if(value == "unbounded")
- {
- maxstr = value;
- maxOccurs = decimal.MaxValue;
- }
- else
- {
- decimal val = decimal.Parse(value);
- if(val >= 0 && (val == Decimal.Truncate(val)))
- {
- maxOccurs = val;
- maxstr = value;
- }
- else
- {
- throw new XmlSchemaException
- ("MaxOccurs must be a non-negative integer",null);
- }
- }
- }
- }
- [System.Xml.Serialization.XmlAttribute("minOccurs")]
- public string MinOccursString
- {
- get{ return minstr; }
- set
- {
- decimal val = decimal.Parse(value);
- if(val >= 0 && (val == Decimal.Truncate(val)))
- {
- minOccurs = val;
- minstr = value;
- }
- else
- {
- throw new XmlSchemaException
- ("MinOccursString must be a non-negative number",null);
- }
- }
- }
- #endregion
- #region XmlIgnore
- [XmlIgnore]
- public decimal MaxOccurs
- {
- get{ return maxOccurs; }
- set
- {
- MaxOccursString = value.ToString();
- }
- }
- [XmlIgnore]
- public decimal MinOccurs
- {
- get{ return minOccurs; }
- set
- {
- MinOccursString = value.ToString();
- }
- }
- #endregion
- }
- }
|