DTDObjectModel.cs 3.2 KB

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