Mono Class Library: System.Xml.XmlTextReader Overview | MembersSystem.Xml.XmlTextReader.ReadChars Method |
Reads the text contents of an element into a character buffer. [Edit]
|
A int containing the number of characters written to buffer, or zero if the current instance is not positioned on an element. [Edit]
Type Reason ArgumentException count > buffer.Length - index. [Edit] ArgumentNullException buffer is null. [Edit] ArgumentOutOfRangeException index < 0, or count < 0. [Edit]
If the end of the character stream in the element is reached before the specified number of characters is read, the return value will be less than count.
This method has the following functionality:
- It is designed to work on element nodes only; it returns zero for other node types.
- It returns the actual character content including markup. There is no attempt to resolve entities, CDATA, or any other markup encountered.
- It ignores XML markup that is not well-formed. For example, when reading the following XML string <A>1<A>2</A>, 1<A>2</A> is returned. (It returns markup from the matching element pair and ignores others.)
- It does not do any normalization.
- When it has reached the end of the character stream, the reader is positioned after the end tag.
- Attribute read methods are not available.
Note:[Edit]Using this method is the most efficient way to process very large streams of text embedded in an XML document. Rather than allocating large string objects, this method returns text content a buffer at a time.
Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0