XmlAttributeAttribute.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. //
  2. // XmlAttributeAttribute.cs:
  3. //
  4. // Author:
  5. // John Donagher ([email protected])
  6. //
  7. // (C) 2002 John Donagher
  8. //
  9. using System.Xml.Schema;
  10. using System;
  11. namespace System.Xml.Serialization
  12. {
  13. /// <summary>
  14. /// Summary description for XmlAttributeAttribute.
  15. /// </summary>
  16. [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
  17. | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
  18. public class XmlAttributeAttribute : Attribute
  19. {
  20. private string attributeName;
  21. private string dataType;
  22. private Type type;
  23. private XmlSchemaForm form;
  24. private string ns;
  25. public XmlAttributeAttribute ()
  26. {
  27. }
  28. public XmlAttributeAttribute (string attributeName)
  29. {
  30. AttributeName = attributeName;
  31. }
  32. public XmlAttributeAttribute (Type type)
  33. {
  34. Type = type;
  35. }
  36. public XmlAttributeAttribute (string attributeName, Type type)
  37. {
  38. AttributeName = attributeName;
  39. Type = type;
  40. }
  41. public string AttributeName {
  42. get {
  43. return attributeName;
  44. }
  45. set {
  46. attributeName = value;
  47. }
  48. }
  49. public string DataType {
  50. get {
  51. return dataType;
  52. }
  53. set {
  54. dataType = value;
  55. }
  56. }
  57. public XmlSchemaForm Form {
  58. get {
  59. return form;
  60. }
  61. set {
  62. form = value;
  63. }
  64. }
  65. public string Namespace {
  66. get {
  67. return ns;
  68. }
  69. set {
  70. ns = value;
  71. }
  72. }
  73. public Type Type
  74. {
  75. get
  76. {
  77. return type;
  78. }
  79. set
  80. {
  81. type = value;
  82. }
  83. }
  84. internal void AddKeyHash (System.Text.StringBuilder sb)
  85. {
  86. sb.Append ("XAA ");
  87. KeyHelper.AddField (sb, 1, ns);
  88. KeyHelper.AddField (sb, 2, attributeName);
  89. KeyHelper.AddField (sb, 3, form.ToString(), XmlSchemaForm.None.ToString());
  90. KeyHelper.AddField (sb, 4, dataType);
  91. KeyHelper.AddField (sb, 5, type);
  92. sb.Append ('|');
  93. }
  94. }
  95. }