mscorlib(4.0.0.0) API with additions
XmlTextReader.cs
3 using System.IO;
5 using System.Text;
6 
7 namespace System.Xml
8 {
10  [EditorBrowsable(EditorBrowsableState.Never)]
11  [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
13  {
14  private XmlTextReaderImpl impl;
15 
18  public override XmlNodeType NodeType => impl.NodeType;
19 
34  public override string Name => impl.Name;
35 
38  public override string LocalName => impl.LocalName;
39 
42  public override string NamespaceURI => impl.NamespaceURI;
43 
46  public override string Prefix => impl.Prefix;
47 
51  public override bool HasValue => impl.HasValue;
52 
73  public override string Value => impl.Value;
74 
77  public override int Depth => impl.Depth;
78 
81  public override string BaseURI => impl.BaseURI;
82 
86  public override bool IsEmptyElement => impl.IsEmptyElement;
87 
90  public override bool IsDefault => impl.IsDefault;
91 
94  public override char QuoteChar => impl.QuoteChar;
95 
98  public override XmlSpace XmlSpace => impl.XmlSpace;
99 
102  public override string XmlLang => impl.XmlLang;
103 
106  public override int AttributeCount => impl.AttributeCount;
107 
111  public override bool EOF => impl.EOF;
112 
115  public override ReadState ReadState => impl.ReadState;
116 
119  public override XmlNameTable NameTable => impl.NameTable;
120 
124  public override bool CanResolveEntity => true;
125 
129  public override bool CanReadBinaryContent => true;
130 
134  public override bool CanReadValueChunk => false;
135 
138  public int LineNumber => impl.LineNumber;
139 
142  public int LinePosition => impl.LinePosition;
143 
148  public bool Namespaces
149  {
150  get
151  {
152  return impl.Namespaces;
153  }
154  set
155  {
156  impl.Namespaces = value;
157  }
158  }
159 
164  public bool Normalization
165  {
166  get
167  {
168  return impl.Normalization;
169  }
170  set
171  {
172  impl.Normalization = value;
173  }
174  }
175 
178  public Encoding Encoding => impl.Encoding;
179 
185  {
186  get
187  {
188  return impl.WhitespaceHandling;
189  }
190  set
191  {
192  impl.WhitespaceHandling = value;
193  }
194  }
195 
199  [Obsolete("Use DtdProcessing property instead.")]
200  public bool ProhibitDtd
201  {
202  get
203  {
204  return impl.DtdProcessing == DtdProcessing.Prohibit;
205  }
206  set
207  {
208  impl.DtdProcessing = ((!value) ? DtdProcessing.Parse : DtdProcessing.Prohibit);
209  }
210  }
211 
215  {
216  get
217  {
218  return impl.DtdProcessing;
219  }
220  set
221  {
222  impl.DtdProcessing = value;
223  }
224  }
225 
229  {
230  get
231  {
232  return impl.EntityHandling;
233  }
234  set
235  {
236  impl.EntityHandling = value;
237  }
238  }
239 
242  public XmlResolver XmlResolver
243  {
244  set
245  {
246  impl.XmlResolver = value;
247  }
248  }
249 
250  internal XmlTextReaderImpl Impl => impl;
251 
252  internal override XmlNamespaceManager NamespaceManager => impl.NamespaceManager;
253 
254  internal bool XmlValidatingReaderCompatibilityMode
255  {
256  set
257  {
258  impl.XmlValidatingReaderCompatibilityMode = value;
259  }
260  }
261 
262  internal override IDtdInfo DtdInfo => impl.DtdInfo;
263 
265  protected XmlTextReader()
266  {
267  impl = new XmlTextReaderImpl();
268  impl.OuterReader = this;
269  }
270 
274  {
275  impl = new XmlTextReaderImpl(nt);
276  impl.OuterReader = this;
277  }
278 
283  public XmlTextReader(Stream input)
284  {
285  impl = new XmlTextReaderImpl(input);
286  impl.OuterReader = this;
287  }
288 
294  public XmlTextReader(string url, Stream input)
295  {
296  impl = new XmlTextReaderImpl(url, input);
297  impl.OuterReader = this;
298  }
299 
305  {
306  impl = new XmlTextReaderImpl(input, nt);
307  impl.OuterReader = this;
308  }
309 
315  public XmlTextReader(string url, Stream input, XmlNameTable nt)
316  {
317  impl = new XmlTextReaderImpl(url, input, nt);
318  impl.OuterReader = this;
319  }
320 
323  public XmlTextReader(TextReader input)
324  {
325  impl = new XmlTextReaderImpl(input);
326  impl.OuterReader = this;
327  }
328 
332  public XmlTextReader(string url, TextReader input)
333  {
334  impl = new XmlTextReaderImpl(url, input);
335  impl.OuterReader = this;
336  }
337 
343  {
344  impl = new XmlTextReaderImpl(input, nt);
345  impl.OuterReader = this;
346  }
347 
353  public XmlTextReader(string url, TextReader input, XmlNameTable nt)
354  {
355  impl = new XmlTextReaderImpl(url, input, nt);
356  impl.OuterReader = this;
357  }
358 
367  public XmlTextReader(Stream xmlFragment, XmlNodeType fragType, XmlParserContext context)
368  {
369  impl = new XmlTextReaderImpl(xmlFragment, fragType, context);
370  impl.OuterReader = this;
371  }
372 
381  public XmlTextReader(string xmlFragment, XmlNodeType fragType, XmlParserContext context)
382  {
383  impl = new XmlTextReaderImpl(xmlFragment, fragType, context);
384  impl.OuterReader = this;
385  }
386 
396  public XmlTextReader(string url)
397  {
398  impl = new XmlTextReaderImpl(url, new NameTable());
399  impl.OuterReader = this;
400  }
401 
413  public XmlTextReader(string url, XmlNameTable nt)
414  {
415  impl = new XmlTextReaderImpl(url, nt);
416  impl.OuterReader = this;
417  }
418 
422  public override string GetAttribute(string name)
423  {
424  return impl.GetAttribute(name);
425  }
426 
431  public override string GetAttribute(string localName, string namespaceURI)
432  {
433  return impl.GetAttribute(localName, namespaceURI);
434  }
435 
440  public override string GetAttribute(int i)
441  {
442  return impl.GetAttribute(i);
443  }
444 
449  public override bool MoveToAttribute(string name)
450  {
451  return impl.MoveToAttribute(name);
452  }
453 
459  public override bool MoveToAttribute(string localName, string namespaceURI)
460  {
461  return impl.MoveToAttribute(localName, namespaceURI);
462  }
463 
467  public override void MoveToAttribute(int i)
468  {
469  impl.MoveToAttribute(i);
470  }
471 
475  public override bool MoveToFirstAttribute()
476  {
477  return impl.MoveToFirstAttribute();
478  }
479 
483  public override bool MoveToNextAttribute()
484  {
485  return impl.MoveToNextAttribute();
486  }
487 
491  public override bool MoveToElement()
492  {
493  return impl.MoveToElement();
494  }
495 
500  public override bool ReadAttributeValue()
501  {
502  return impl.ReadAttributeValue();
503  }
504 
509  public override bool Read()
510  {
511  return impl.Read();
512  }
513 
515  public override void Close()
516  {
517  impl.Close();
518  }
519 
521  public override void Skip()
522  {
523  impl.Skip();
524  }
525 
530  public override string LookupNamespace(string prefix)
531  {
532  string text = impl.LookupNamespace(prefix);
533  if (text != null && text.Length == 0)
534  {
535  text = null;
536  }
537  return text;
538  }
539 
541  public override void ResolveEntity()
542  {
543  impl.ResolveEntity();
544  }
545 
555  public override int ReadContentAsBase64(byte[] buffer, int index, int count)
556  {
557  return impl.ReadContentAsBase64(buffer, index, count);
558  }
559 
571  public override int ReadElementContentAsBase64(byte[] buffer, int index, int count)
572  {
573  return impl.ReadElementContentAsBase64(buffer, index, count);
574  }
575 
586  public override int ReadContentAsBinHex(byte[] buffer, int index, int count)
587  {
588  return impl.ReadContentAsBinHex(buffer, index, count);
589  }
590 
602  public override int ReadElementContentAsBinHex(byte[] buffer, int index, int count)
603  {
604  return impl.ReadElementContentAsBinHex(buffer, index, count);
605  }
606 
612  public override string ReadString()
613  {
614  impl.MoveOffEntityReference();
615  return base.ReadString();
616  }
617 
621  public bool HasLineInfo()
622  {
623  return true;
624  }
625 
630  {
631  return impl.GetNamespacesInScope(scope);
632  }
633 
637  string IXmlNamespaceResolver.LookupNamespace(string prefix)
638  {
639  return impl.LookupNamespace(prefix);
640  }
641 
645  string IXmlNamespaceResolver.LookupPrefix(string namespaceName)
646  {
647  return impl.LookupPrefix(namespaceName);
648  }
649 
654  {
655  return impl.GetNamespacesInScope(scope);
656  }
657 
661  public void ResetState()
662  {
663  impl.ResetState();
664  }
665 
669  {
670  return impl.GetRemainder();
671  }
672 
684  public int ReadChars(char[] buffer, int index, int count)
685  {
686  return impl.ReadChars(buffer, index, count);
687  }
688 
698  public int ReadBase64(byte[] array, int offset, int len)
699  {
700  return impl.ReadBase64(array, offset, len);
701  }
702 
712  public int ReadBinHex(byte[] array, int offset, int len)
713  {
714  return impl.ReadBinHex(array, offset, len);
715  }
716  }
717 }
Represents a character encoding.To browse the .NET Framework source code for this type,...
Definition: Encoding.cs:15
NameTable()
Initializes a new instance of the NameTable class.
Definition: NameTable.cs:33
Provides an interface to enable a class to return line and position information.
Definition: IXmlLineInfo.cs:5
XmlTextReader(Stream xmlFragment, XmlNodeType fragType, XmlParserContext context)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified stream,...
override string NamespaceURI
Gets the namespace URI (as defined in the W3C Namespace specification) of the node on which the reade...
XmlTextReader(string url, TextReader input, XmlNameTable nt)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified URL,...
TextReader GetRemainder()
Gets the remainder of the buffered XML.
void ResetState()
Resets the state of the reader to ReadState.Initial.
bool? ProhibitDtd
Gets or sets a value indicating whether to allow DTD processing. This property is obsolete....
override string LookupNamespace(string prefix)
Resolves a namespace prefix in the current element's scope.
IDictionary< string, string > GetNamespacesInScope(XmlNamespaceScope scope)
Gets a collection that contains all namespaces currently in-scope.
override XmlNodeType NodeType
Gets the type of the current node.
EditorBrowsableState
Specifies the browsable state of a property or method from within an editor.
override char QuoteChar
Gets the quotation mark character used to enclose the value of an attribute node.
Definition: __Canon.cs:3
override XmlNameTable NameTable
Gets the T:System.Xml.XmlNameTable associated with this implementation.
override int Depth
Gets the depth of the current node in the XML document.
override string ReadString()
Reads the contents of an element or a text node as a string.
Resolves external XML resources named by a Uniform Resource Identifier (URI).
Definition: XmlResolver.cs:8
bool Normalization
Gets or sets a value indicating whether to normalize white space and attribute values.
override string Name
Gets the qualified name of the current node.
override bool MoveToFirstAttribute()
Moves to the first attribute.
XmlNodeType
Specifies the type of node.
Definition: XmlNodeType.cs:5
EntityHandling
Specifies how the T:System.Xml.XmlTextReader or T:System.Xml.XmlValidatingReader handle entities.
override bool ReadAttributeValue()
Parses the attribute value into one or more Text, EntityReference, or EndEntity nodes.
WhitespaceHandling
Specifies how white space is handled.
XmlTextReader(string url, Stream input)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified URL and stream.
Provides all the context information required by the T:System.Xml.XmlReader to parse an XML fragment.
Represents a reader that provides fast, non-cached, forward-only access to XML data....
override int ReadElementContentAsBinHex(byte[] buffer, int index, int count)
Reads the element and decodes the BinHex content.
override string Value
Gets the text value of the current node.
XmlNamespaceScope
Defines the namespace scope.
XmlTextReader(Stream input, XmlNameTable nt)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified stream and T:Sy...
Represents a reader that provides fast, noncached, forward-only access to XML data....
Definition: XmlReader.cs:15
int ReadBinHex(byte[] array, int offset, int len)
Decodes BinHex and returns the decoded binary bytes.
override bool CanResolveEntity
Gets a value indicating whether this reader can parse and resolve entities.
XmlTextReader()
Initializes a new instance of the XmlTextReader.
override bool MoveToAttribute(string localName, string namespaceURI)
Moves to the attribute with the specified local name and namespace URI.
IDictionary< string, string > GetNamespacesInScope(XmlNamespaceScope scope)
Gets a collection of defined prefix-namespace mappings that are currently in scope.
SecurityAction
Specifies the security actions that can be performed using declarative security.
override void MoveToAttribute(int i)
Moves to the attribute with the specified index.
Implements a single-threaded T:System.Xml.XmlNameTable.
Definition: NameTable.cs:5
override string GetAttribute(int i)
Gets the value of the attribute with the specified index.
override bool MoveToAttribute(string name)
Moves to the attribute with the specified name.
XmlTextReader(TextReader input)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified T:System....
override int AttributeCount
Gets the number of attributes on the current node.
XmlTextReader(TextReader input, XmlNameTable nt)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified T:System....
override string GetAttribute(string localName, string namespaceURI)
Gets the value of the attribute with the specified local name and namespace URI.
override string Prefix
Gets the namespace prefix associated with the current node.
XmlTextReader(string url, TextReader input)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified URL and T:Syste...
XmlTextReader(XmlNameTable nt)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified T:System....
Resolves, adds, and removes namespaces to a collection and provides scope management for these namesp...
override void Skip()
Skips the children of the current node.
override string GetAttribute(string name)
Gets the value of the attribute with the specified name.
XmlTextReader(string url, XmlNameTable nt)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified file and T:Syst...
int ReadBase64(byte[] array, int offset, int len)
Decodes Base64 and returns the decoded binary bytes.
int ReadChars(char[] buffer, int index, int count)
Reads the text contents of an element into a character buffer. This method is designed to read large ...
XmlTextReader(string url, Stream input, XmlNameTable nt)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified URL,...
override void Close()
Changes the P:System.Xml.XmlReader.ReadState to Closed.
Table of atomized string objects.
Definition: XmlNameTable.cs:5
ReadState
Specifies the state of the reader.
Definition: ReadState.cs:5
override bool CanReadValueChunk
Gets a value indicating whether the T:System.Xml.XmlTextReader implements the M:System....
override bool IsEmptyElement
Gets a value indicating whether the current node is an empty element (for example,...
override int ReadContentAsBinHex(byte[] buffer, int index, int count)
Reads the content and returns the BinHex decoded binary bytes.
override string XmlLang
Gets the current xml:lang scope.
XmlTextReader(Stream input)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified stream.
override bool MoveToElement()
Moves to the element that contains the current attribute node.
override int ReadContentAsBase64(byte[] buffer, int index, int count)
Reads the content and returns the Base64 decoded binary bytes.
override void ResolveEntity()
Resolves the entity reference for EntityReference nodes.
override bool HasValue
Gets a value indicating whether the current node can have a P:System.Xml.XmlTextReader....
bool HasLineInfo()
Gets a value indicating whether the class can return line information.
Represents a reader that can read a sequential series of characters.
Definition: TextReader.cs:14
Provides read-only access to a set of prefix and namespace mappings.
override bool Read()
Reads the next node from the stream.
XmlTextReader(string xmlFragment, XmlNodeType fragType, XmlParserContext context)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified string,...
override bool CanReadBinaryContent
Gets a value indicating whether the T:System.Xml.XmlTextReader implements the binary content read met...
int LinePosition
Gets the current line position.
override int ReadElementContentAsBase64(byte[] buffer, int index, int count)
Reads the element and decodes the Base64 content.
DtdProcessing
Specifies the options for processing DTDs. The T:System.Xml.DtdProcessing enumeration is used by the ...
Definition: DtdProcessing.cs:5
override bool EOF
Gets a value indicating whether the reader is positioned at the end of the stream.
override string BaseURI
Gets the base URI of the current node.
Encoding()
Initializes a new instance of the T:System.Text.Encoding class.
Definition: Encoding.cs:1053
XmlSpace
Specifies the current xml:space scope.
Definition: XmlSpace.cs:5
int LineNumber
Gets the current line number.
override bool IsDefault
Gets a value indicating whether the current node is an attribute that was generated from the default ...
override string LocalName
Gets the local name of the current node.
bool Namespaces
Gets or sets a value indicating whether to do namespace support.
XmlTextReader(string url)
Initializes a new instance of the T:System.Xml.XmlTextReader class with the specified file.
override bool MoveToNextAttribute()
Moves to the next attribute.
Provides a generic view of a sequence of bytes. This is an abstract class.To browse the ....
Definition: Stream.cs:16