XmlSchemaAttribute.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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.None;
  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. [DefaultValue(null)]
  39. [System.Xml.Serialization.XmlAttribute("default")]
  40. public string DefaultValue
  41. {
  42. get{ return defaultValue;}
  43. set
  44. { // Default Value and fixed Value are mutually exclusive
  45. fixedValue = null;
  46. defaultValue = value;
  47. }
  48. }
  49. [DefaultValue(null)]
  50. [System.Xml.Serialization.XmlAttribute("fixed")]
  51. public string FixedValue
  52. {
  53. get{ return fixedValue;}
  54. set
  55. { // Default Value and fixed Value are mutually exclusive
  56. defaultValue = null;
  57. fixedValue = value;
  58. }
  59. }
  60. [DefaultValue(XmlSchemaForm.None)]
  61. [System.Xml.Serialization.XmlAttribute("form")]
  62. public XmlSchemaForm Form
  63. {
  64. get{ return form;}
  65. set{ form = value;}
  66. }
  67. [System.Xml.Serialization.XmlAttribute("name")]
  68. public string Name
  69. {
  70. get{ return name;}
  71. set
  72. { // Name and RefName are mutually exclusive
  73. refName = null;
  74. name = value;
  75. }
  76. }
  77. [XmlIgnore]
  78. public XmlQualifiedName QualifiedName
  79. {
  80. get{ return qualifiedName;}
  81. }
  82. [System.Xml.Serialization.XmlAttribute("ref")]
  83. public XmlQualifiedName RefName
  84. {
  85. get{ return refName;}
  86. set
  87. { // Name and RefName are mutually exclusive
  88. name = null;
  89. refName = value;
  90. }
  91. }
  92. [XmlElement("simpleType",Namespace="http://www.w3.org/2001/XMLSchema")]
  93. public XmlSchemaSimpleType SchemaType
  94. {
  95. get{ return schemaType;}
  96. set{ schemaType = value;}
  97. }
  98. [System.Xml.Serialization.XmlAttribute("type")]
  99. public XmlQualifiedName SchemaTypeName
  100. {
  101. get{ return schemaTypeName;}
  102. set{ schemaTypeName = value;}
  103. }
  104. [DefaultValue(XmlSchemaUse.None)]
  105. [System.Xml.Serialization.XmlAttribute("use")]
  106. public XmlSchemaUse Use
  107. {
  108. get{ return use;}
  109. set{ use = value;}
  110. }
  111. }
  112. }