XmlSchemaAttribute.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // Author: Dwivedi, Ajay kumar
  2. // [email protected]
  3. using System;
  4. using System.Xml;
  5. using System.ComponentModel;
  6. using System.Xml.Serialization;
  7. namespace System.Xml.Schema
  8. {
  9. /// <summary>
  10. /// Summary description for XmlSchemaAttribute.
  11. /// </summary>
  12. public class XmlSchemaAttribute : XmlSchemaAnnotated
  13. {
  14. private object attributeType;
  15. private string defaultValue;
  16. private string fixedValue;
  17. private XmlSchemaForm form;
  18. private string name;
  19. private XmlQualifiedName qualifiedName;
  20. private XmlQualifiedName refName;
  21. private XmlSchemaSimpleType schemaType;
  22. private XmlQualifiedName schemaTypeName;
  23. private XmlSchemaUse use;
  24. public XmlSchemaAttribute()
  25. {
  26. //FIXME: Docs says the default is optional.
  27. //Whereas the MS implementation has default None.
  28. use = XmlSchemaUse.Optional;
  29. qualifiedName = XmlQualifiedName.Empty;
  30. refName = XmlQualifiedName.Empty;
  31. }
  32. // Properties
  33. [XmlIgnore]
  34. public object AttributeType
  35. { //FIXME: This is not correct. Is it?
  36. get{ return attributeType; }
  37. }
  38. //FIXME: what is the default value?
  39. [DefaultValue("")]
  40. [XmlAttribute]
  41. public string DefaultValue
  42. {
  43. get{ return defaultValue;}
  44. set
  45. { // Default Value and fixed Value are mutually exclusive
  46. fixedValue = null;
  47. defaultValue = value;
  48. }
  49. }
  50. [DefaultValue("")]
  51. [XmlAttribute]
  52. public string FixedValue
  53. {
  54. get{ return fixedValue;}
  55. set
  56. { // Default Value and fixed Value are mutually exclusive
  57. defaultValue = null;
  58. fixedValue = value;
  59. }
  60. }
  61. [DefaultValue(XmlSchemaForm.None)]
  62. [XmlAttribute]
  63. public XmlSchemaForm Form
  64. {
  65. get{ return form;}
  66. set{ form = value;}
  67. }
  68. [XmlAttribute]
  69. public string Name
  70. {
  71. get{ return name;}
  72. set
  73. { // Name and RefName are mutually exclusive
  74. refName = null;
  75. name = value;
  76. }
  77. }
  78. [XmlIgnore]
  79. public XmlQualifiedName QualifiedName
  80. {
  81. get{ return qualifiedName;}
  82. }
  83. [XmlAttribute]
  84. public XmlQualifiedName RefName
  85. {
  86. get{ return refName;}
  87. set
  88. { // Name and RefName are mutually exclusive
  89. name = null;
  90. refName = value;
  91. }
  92. }
  93. [XmlElement]
  94. public XmlSchemaSimpleType SchemaType
  95. {
  96. get{ return schemaType;}
  97. set{ schemaType = value;}
  98. }
  99. [XmlAttribute]
  100. public XmlQualifiedName SchemaTypeName
  101. {
  102. get{ return schemaTypeName;}
  103. set{ schemaTypeName = value;}
  104. }
  105. [DefaultValue(XmlSchemaUse.Optional)]
  106. [XmlAttribute]
  107. public XmlSchemaUse Use
  108. {
  109. get{ return use;}
  110. set{ use = value;}
  111. }
  112. }
  113. }