DTDObjectModel.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. //
  2. // Mono.Xml.DTDObjectModel
  3. //
  4. // Author:
  5. // Atsushi Enomoto ([email protected])
  6. //
  7. // (C)2003 Atsushi Enomoto
  8. //
  9. using System;
  10. using System.Collections;
  11. using System.Xml;
  12. namespace Mono.Xml
  13. {
  14. public class DTDObjectModel
  15. {
  16. public DTDObjectModel ()
  17. {
  18. }
  19. internal Hashtable ElementDecls = new Hashtable ();
  20. internal Hashtable AttListDecls = new Hashtable ();
  21. internal Hashtable EntityDecls = new Hashtable ();
  22. internal Hashtable NotationDecls = new Hashtable ();
  23. [MonoTODO()]
  24. public string BaseURI {
  25. // XmlStreamParser.BaseURI
  26. get { return baseURI; }
  27. }
  28. public string Name;
  29. public string PublicId;
  30. public string SystemId;
  31. public string InternalSubset;
  32. string baseURI;
  33. }
  34. public enum DTDContentOrderType
  35. {
  36. None,
  37. Seq,
  38. Or
  39. }
  40. public enum DTDAttributeType
  41. {
  42. None,
  43. CData,
  44. Id,
  45. IdRef,
  46. IdRefs,
  47. Entity,
  48. Entities,
  49. NmToken,
  50. NmTokens,
  51. Notation
  52. }
  53. public enum DTDAttributeOccurenceType
  54. {
  55. None,
  56. Required,
  57. Optional,
  58. Fixed
  59. }
  60. public class DTDContentModel
  61. {
  62. public string ElementName;
  63. public DTDContentOrderType OrderType = DTDContentOrderType.None;
  64. public ArrayList ChildModels = new ArrayList ();
  65. public decimal MinOccurs = 1;
  66. public decimal MaxOccurs = 1;
  67. internal DTDContentModel () {}
  68. }
  69. public class DTDElementDeclaration : ICloneable
  70. {
  71. public string Name;
  72. public bool IsEmpty;
  73. public bool IsAny;
  74. public bool IsMixedContent;
  75. public DTDContentModel ContentModel = new DTDContentModel ();
  76. internal DTDElementDeclaration () {}
  77. public object Clone ()
  78. {
  79. return this.MemberwiseClone ();
  80. }
  81. }
  82. public class DTDAttributeDefinition : ICloneable
  83. {
  84. public string Name;
  85. public DTDAttributeType AttributeType = DTDAttributeType.None;
  86. // entity reference inside enumerated values are not allowed,
  87. // but on the other hand, they are allowed inside default value.
  88. // Then I decided to use string ArrayList for enumerated values,
  89. // and unresolved string value for DefaultValue.
  90. public ArrayList EnumeratedAttributeDeclaration = new ArrayList ();
  91. public string UnresolvedDefaultValue = null;
  92. public ArrayList EnumeratedNotations = new ArrayList();
  93. public DTDAttributeOccurenceType OccurenceType = DTDAttributeOccurenceType.None;
  94. internal DTDAttributeDefinition () {}
  95. public object Clone ()
  96. {
  97. return this.MemberwiseClone ();
  98. }
  99. }
  100. public class DTDAttListDeclaration : ICloneable
  101. {
  102. public string Name;
  103. public Hashtable AttributeDefinitions = new Hashtable ();
  104. internal DTDAttListDeclaration () {}
  105. public object Clone ()
  106. {
  107. return this.MemberwiseClone ();
  108. }
  109. }
  110. public class DTDEntityDeclaration
  111. {
  112. public string Name;
  113. public string PublicId;
  114. public string SystemId;
  115. public string NotationName;
  116. // FIXME: should have more complex value than simple string
  117. public string EntityValue;
  118. internal DTDEntityDeclaration () {}
  119. }
  120. public class DTDNotationDeclaration
  121. {
  122. public string Name;
  123. public string LocalName;
  124. public string Prefix;
  125. public string PublicId;
  126. public string SystemId;
  127. internal DTDNotationDeclaration () {}
  128. }
  129. public class DTDParameterEntityDeclaration
  130. {
  131. public string Name;
  132. public string PublicId;
  133. public string SystemId;
  134. public string BaseURI;
  135. public string Value;
  136. }
  137. }