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