Welcome to mirror list, hosted at ThFree Co, Russian Federation.

XmlMappingDictionary.cs « System.Xml.Query « System.Data.SqlXml « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 75bb31d2a8a60b99e502a04ad482b7490ede906f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
//
// System.Xml.Query.XmlMappingDictionary
//
// Author:
//	Atsushi Enomoto <atsushi@ximian.com>
//
// (C)2004 Novell Inc.
//

#if NET_2_0

namespace System.Xml.Query 
{
	public sealed class XmlMappingDictionary
		: IDictionary, ICollection, IEnumerable, IXmlCompilerInclude
	{
		private Hashtable mappings;

		public XmlMappingDictionary ()
		{
			mappings = new Hashtable ();
		}

		public event QueryEventHandler OnProcessingEvent;

		[MonoTODO ("Check name conflicts")]
		public XmlMapping Add (string name, string mappingUrl)
		{
			using (XmlReader xr = new XmlTextReader (mappingUrl)) {
				return Add (name, xr);
			}
		}

		[MonoTODO ("Check name conflicts")]
		public XmlMapping Add (string name, XmlReader reader)
		{
			XmlMapping map = mapppings [name] as XmlMapping;
			if (map != null) {
				map = new XmlMapping (reader);
				mappings [name] = map;
			}
			return map;
		}

		[MonoTODO ("Check name conflicts")]
		public void Add (string name, XmlMapping mapping)
		{
			mappings.Add (name, mapping);
		}

		// Why virtual method inside sealed class :-?
		public virtual void Clear ()
		{
			mappings.Clear ();
		}

		public bool Contains (string name)
		{
			return mappings.Contains (name);
		}

		public virtual IDictionaryEnumerator GetEnumerator ()
		{
			return mappings.GetEnumerator ();
		}

		public void Remove (string name)
		{
			mappings.Remove (name);
		}

		public virtual int Count {
			get { return mappings.Count; }
		}

		public XmlMapping this [string name] {
			get { return mappings [name] as XmlMapping; }
			set { mappings [name] = value; }
		}

		void ICollections.CopyTo (Array array, int index)
		{
			mappings.CopyTo (array, index);
		}

		[MonoTODO]
		bool ICollection.IsSynchronized {
			get { throw new NotImplementedException (); }
		}

		[MonoTODO]
		object ICollection.SyncRoot {
			get { throw new NotImplementedException (); }
		}

		[MonoTODO ("What if invalid type value?")]
		void IDictionary.Add (object key, object value)
		{
			if (value is string)
				Add ((string) key, (string) value);
			else if (value is XmlReader)
				Add ((string) key, (XmlReader) value);
			else
				Add ((string) key, (XmlMapping) value);
		}

		bool IDictionary.Contains (object key)
		{
			return Containts ((string) key);
		}

		bool IDictionary IsFixedSize {
			get { return false; }
		}

		bool IDictionary.IsReadOnly {
			get { return false; }
		}

		object IDictionary.this [object key] {
			get { return this [(string) key]; }
			set { this [(string) key] = (XmlMapping) value; }
		}

		ICollection IDictionary.Keys {
			get { return mappings.Keys; }
		}

		ICollection IDictionary.Values {
			get { return mappings.Values; }
		}

		void IDictionary.Remove (object key)
		{
			mappings.Remove ((string) key);
		}

		IEnumerator IEnumerable.GetEnumerator ()
		{
			return GetEnumerator ();
		}

		[MonoTODO]
		XmlExpression IXmlCompilerInclude.ResolveContextDocument ()
		{
			throw new NotImplementedException ();
		}

		[MonoTODO]
		XmlExpression IXmlCompilerInclude.ResolveContextFunction (
			XmlQualifiedName funcName, object [] funcParams)
		{
			throw new NotImplementedException ();
		}

		[MonoTODO]
		XmlExpression IXmlCompilerInclude.ResolveContextDocument (
			XmlQualifiedName varName)
		{
			throw new NotImplementedException ();
		}
	}
}

#endif // NET_2_0