File: DelegatingXmlDictionaryReader.cs

package info (click to toggle)
mono 4.6.2.7%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 778,148 kB
  • ctags: 914,052
  • sloc: cs: 5,779,509; xml: 2,773,713; ansic: 432,645; sh: 14,749; makefile: 12,361; perl: 2,488; python: 1,434; cpp: 849; asm: 531; sql: 95; sed: 16; php: 1
file content (427 lines) | stat: -rw-r--r-- 15,448 bytes parent folder | download | duplicates (7)
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------

namespace System.IdentityModel
{
    using System.Xml;

    /// <summary>
    /// Class wraps a given reader and delegates all XmlDictionaryReader calls 
    /// to the inner wrapped reader.
    /// </summary>
    public class DelegatingXmlDictionaryReader : XmlDictionaryReader
    {
        XmlDictionaryReader _innerReader;

        /// <summary>
        /// Initializes a new instance of <see cref="DelegatingXmlDictionaryWriter" />
        /// </summary>
        protected DelegatingXmlDictionaryReader()
        {
        }

        /// <summary>
        /// Initializes the Inner reader that this instance wraps.
        /// </summary>
        /// <param name="innerReader">XmlDictionaryReader to wrap.</param>
        protected void InitializeInnerReader(XmlDictionaryReader innerReader)
        {
            if (innerReader == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("innerReader");
            }

            _innerReader = innerReader;
        }

        /// <summary>
        /// Gets the wrapped inner reader.
        /// </summary>
        protected XmlDictionaryReader InnerReader
        {
            get { return _innerReader; }
        }

        /// <summary>
        /// Gets the value of the attribute with the specified index.
        /// </summary>
        /// <param name="i">index of the attribute.</param>
        /// <returns>Attribute value at the specified index.</returns>
        public override string this[int i]
        {
            get { return _innerReader[i]; }
        }

        /// <summary>
        /// Gets the value of the attribute with the specified System.Xml.XmlReader.Name.
        /// </summary>
        /// <param name="name">The qualified name of the attribute.</param>
        /// <returns>The value of the specified attribute. If the attribute is not found, 
        /// null is returned.</returns>
        public override string this[string name]
        {
            get { return _innerReader[name]; }
        }

        /// <summary>
        /// Gets the value of the attribute with the specified System.Xml.XmlReader.LocalName and 
        /// System.Xml.XmlReader.NamespaceURI from the wrapped reader.
        /// </summary>
        /// <param name="name">The local name of the attribute.</param>
        /// <param name="namespaceURI">The namespace URI of the attribute.</param>
        /// <returns>The value of the specified attribute. If the attribute is not found, 
        /// null is returned.</returns>
        public override string this[string name, string namespaceURI]
        {
            get { return _innerReader[name, namespaceURI]; }
        }

        /// <summary>
        /// Gets the number of Attributes at the current reader position.
        /// </summary>
        public override int AttributeCount
        {
            get { return _innerReader.AttributeCount; }
        }

        /// <summary>
        /// Gets the base Uri of the current node.
        /// </summary>
        public override string BaseURI
        {
            get { return _innerReader.BaseURI; }
        }

        /// <summary>
        /// Gets the Depth of the current node.
        /// </summary>
        public override int Depth
        {
            get { return _innerReader.Depth; }
        }

        /// <summary>
        /// Gets a value indicating if reader is positioned at the end of the stream.
        /// </summary>
        public override bool EOF
        {
            get { return _innerReader.EOF; }
        }

        /// <summary>
        /// Gets a value indicating if the current node can have a 
        /// System.Xml.XmlReader.Value.
        /// </summary>
        public override bool HasValue
        {
            get { return _innerReader.HasValue; }
        }

        /// <summary>
        /// Gets a value indicating if the current node is an attribute that
        /// was generated from the default value defined in the DTD or Schema.
        /// </summary>
        public override bool IsDefault
        {
            get { return _innerReader.IsDefault; }
        }

        /// <summary>
        /// Gets a value indicating if the current node.
        /// </summary>
        public override bool IsEmptyElement
        {
            get { return _innerReader.IsEmptyElement; }
        }

        /// <summary>
        /// Gets the local name of the current node.
        /// </summary>
        public override string LocalName
        {
            get { return _innerReader.LocalName; }
        }

        /// <summary>
        /// Gets the qualified name of the current node.
        /// </summary>
        public override string Name
        {
            get { return _innerReader.Name; }
        }

        /// <summary>
        /// Gets the namespace URI of the current node.
        /// </summary>
        public override string NamespaceURI
        {
            get { return _innerReader.NamespaceURI; }
        }

        /// <summary>
        /// Gets the System.Xml.XmlNameTable associated with this instance.
        /// </summary>
        public override XmlNameTable NameTable
        {
            get { return _innerReader.NameTable; }
        }

        /// <summary>
        /// Gets the type of the current node.
        /// </summary>
        public override XmlNodeType NodeType
        {
            get { return _innerReader.NodeType; }
        }

        /// <summary>
        /// Gets the prefix of the current node.
        /// </summary>
        public override string Prefix
        {
            get { return _innerReader.Prefix; }
        }

        /// <summary>
        /// Gets the quotation mark character used to enclose the attribute node. (" or ')
        /// </summary>
        public override char QuoteChar
        {
            get { return _innerReader.QuoteChar; }
        }

        /// <summary>
        /// Gets the System.Xml.ReadState of the reader. 
        /// </summary>
        public override ReadState ReadState
        {
            get { return _innerReader.ReadState; }
        }

        /// <summary>
        /// Gets the text value of the current node.
        /// </summary>
        public override string Value
        {
            get { return _innerReader.Value; }
        }

        /// <summary>
        /// Gets the Common Language Runtime (CLR) type of the curent node.
        /// </summary>
        public override Type ValueType
        {
            get { return _innerReader.ValueType; }
        }

        /// <summary>
        /// Gets the xml:lang scope.
        /// </summary>
        public override string XmlLang
        {
            get { return _innerReader.XmlLang; }
        }

        /// <summary>
        /// Gets the current xml:space scope. If no xml:space scope exists, this property 
        /// defaults to XmlSpace.None.
        /// </summary>
        public override XmlSpace XmlSpace
        {
            get { return _innerReader.XmlSpace; }
        }

        /// <summary>
        /// Closes the reader and changes the System.Xml.XmlReader.ReadState
        /// to Closed.
        /// </summary>
        public override void Close()
        {
            _innerReader.Close();
        }

        /// <summary>
        /// Gets the value of the attribute at the given index.
        /// </summary>
        /// <param name="i">The index of the attribute. The index is 0 based index.</param>
        /// <returns>The value of the attribute at the specified index.</returns>
        /// <remarks>The method does not move the reader position.</remarks>
        public override string GetAttribute(int i)
        {
            return _innerReader.GetAttribute(i);
        }

        /// <summary>
        /// Gets the value of the attribute with the given name.
        /// </summary>
        /// <param name="name">The qualified name of the attribute.</param>
        /// <returns>The value of the attribute. If the attribute is not found null
        /// is returned.</returns>
        /// <remarks>The method does not move the reader position.</remarks>
        public override string GetAttribute(string name)
        {
            return _innerReader.GetAttribute(name);
        }

        /// <summary>
        /// Gets the value of the attribute with the given name and namespace Uri.
        /// </summary>
        /// <param name="name">The local name of the attribute.</param>
        /// <param name="namespaceURI">The namespace of the attribute.</param>
        /// <returns>The value of the attribute. If the attribute is not found
        /// null is returned.</returns>
        /// <remarks>The method does not move the reader.</remarks>
        public override string GetAttribute(string name, string namespaceURI)
        {
            return _innerReader.GetAttribute(name, namespaceURI);
        }

        /// <summary>
        /// Resolves a namespace prefix in the current element scope.
        /// </summary>
        /// <param name="prefix">Prefix whose namespace Uri to be resolved.</param>
        /// <returns>The namespace Uri to which the prefix matches or null if no matching
        /// prefix is found.</returns>
        public override string LookupNamespace(string prefix)
        {
            return _innerReader.LookupNamespace(prefix);
        }

        /// <summary>
        /// Moves to the attribute with the specified index.
        /// </summary>
        /// <param name="i">The index of the attribute.</param>
        public override void MoveToAttribute(int i)
        {
            _innerReader.MoveToAttribute(i);
        }

        /// <summary>
        /// Moves to the attribute with the given local name.
        /// </summary>
        /// <param name="name">The qualified name of the attribute.</param>
        /// <returns>true if the attribute is found; otherwise, false.</returns>
        public override bool MoveToAttribute(string name)
        {
            return _innerReader.MoveToAttribute(name);
        }

        /// <summary>
        /// Moves to the attribute with the specified System.Xml.XmlReader.LocalName and 
        /// System.Xml.XmlReader.NamespaceURI.
        /// </summary>
        /// <param name="name">The local name of the attribute.</param>
        /// <param name="ns">The namespace URI of the attribute.</param>
        /// <returns>true if the attribute is found; otherwise, false.</returns>
        public override bool MoveToAttribute(string name, string ns)
        {
            return _innerReader.MoveToAttribute(name, ns);
        }

        /// <summary>
        /// Moves to a node of type Element.
        /// </summary>
        /// <returns>true if the reader is positioned on an element else false</returns>
        public override bool MoveToElement()
        {
            return _innerReader.MoveToElement();
        }

        /// <summary>
        /// Moves to the first attribute.
        /// </summary>
        /// <returns>Returns true if the reader is positioned at a attribute else false.</returns>
        /// <remarks>When returning false the reader position will not be changed.</remarks>
        public override bool MoveToFirstAttribute()
        {
            return _innerReader.MoveToFirstAttribute();
        }

        /// <summary>
        /// Moves the reader to the next attribute.
        /// </summary>
        /// <returns>Returns true if the reader is positioned at an attribute else false.</returns>
        /// <remarks>When returning false the reader position will not be changed.</remarks>
        public override bool MoveToNextAttribute()
        {
            return _innerReader.MoveToNextAttribute();
        }

        /// <summary>
        /// Reads the next node from the stream.
        /// </summary>
        /// <returns>true if the next node was read successfully.</returns>
        public override bool Read()
        {
            return _innerReader.Read();
        }

        /// <summary>
        /// Parses the attribute value into one or more Text, EntityReference, or EndEntity nodes.
        /// </summary>
        /// <returns>true if there are nodes to return.false if the reader is not positioned on
        /// an attribute node when the initial call is made or if all the attribute values
        /// have been read.</returns>
        public override bool ReadAttributeValue()
        {
            return _innerReader.ReadAttributeValue();
        }

        /// <summary>
        /// Reads the content and returns the Base64 decoded binary bytes.
        /// </summary>
        /// <param name="buffer">The buffer into which to copy the resulting text. This value cannot be null.</param>
        /// <param name="index">The offset into the buffer where to start copying the result.</param>
        /// <param name="count">The maximum number of bytes to copy into the buffer.</param>
        /// <returns>The number of bytes written to the buffer.</returns>
        public override int ReadContentAsBase64(byte[] buffer, int index, int count)
        {
            return _innerReader.ReadContentAsBase64(buffer, index, count);
        }

        /// <summary>
        /// Reads the content and returns the BinHex decoded binary bytes.
        /// </summary>
        /// <param name="buffer">The buffer into which to copy the resulting text. This value cannot be null.</param>
        /// <param name="index">The offset into the buffer where to start copying the result.</param>
        /// <param name="count">The maximum number of bytes to copy into the buffer.</param>
        /// <returns>The number of bytes written to the buffer.</returns>
        public override int ReadContentAsBinHex(byte[] buffer, int index, int count)
        {
            return _innerReader.ReadContentAsBinHex(buffer, index, count);
        }

        /// <summary>
        /// Reads the content and returns the contained string.
        /// </summary>
        public override System.Xml.UniqueId ReadContentAsUniqueId()
        {
            return _innerReader.ReadContentAsUniqueId();
        }

        /// <summary>
        /// Reads large streams of text embedded in an XML document.
        /// </summary>
        /// <param name="buffer">The array of characters that serves as the buffer to which the text contents
        /// are written. This value cannot be null.</param>
        /// <param name="index">The offset within the buffer where the System.Xml.XmlReader can start to
        /// copy the results.</param>
        /// <param name="count">The maximum number of characters to copy into the buffer. The actual number
        /// of characters copied is returned from this method.</param>
        /// <returns>The number of characters read into the buffer. The value zero is returned
        /// when there is no more text content.</returns>
        public override int ReadValueChunk(char[] buffer, int index, int count)
        {
            return _innerReader.ReadValueChunk(buffer, index, count);
        }

        /// <summary>
        /// Resolves the entity reference for EntityReference nodes.
        /// </summary>
        public override void ResolveEntity()
        {
            _innerReader.ResolveEntity();
        }
    }
}