Inheritance: IncrementalReadDecoder
Esempio n. 1
0
        // Reads the contents of an element including markup into a character buffer. Wellformedness checks are limited.
        // This method is designed to read large streams of embedded text by calling it successively.
        internal int ReadChars(char[] buffer, int index, int count)
        {
            Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadChars cannot be called on reader created via XmlReader.Create.");
            Debug.Assert(_outerReader is XmlTextReader);

            if (_parsingFunction == ParsingFunction.InIncrementalRead)
            {
                if (_incReadDecoder != _readCharsDecoder)
                { // mixing ReadChars with ReadBase64 or ReadBinHex
                    if (_readCharsDecoder == null)
                    {
                        _readCharsDecoder = new IncrementalReadCharsDecoder();
                    }
                    _readCharsDecoder.Reset();
                    _incReadDecoder = _readCharsDecoder;
                }
                return IncrementalRead(buffer, index, count);
            }
            else
            {
                if (_curNode.type != XmlNodeType.Element)
                {
                    return 0;
                }
                if (_curNode.IsEmptyElement)
                {
                    _outerReader.Read();
                    return 0;
                }

                if (_readCharsDecoder == null)
                {
                    _readCharsDecoder = new IncrementalReadCharsDecoder();
                }

                InitIncrementalRead(_readCharsDecoder);
                return IncrementalRead(buffer, index, count);
            }
        }
Esempio n. 2
0
        // Reads the contents of an element including markup into a character buffer. Wellformedness checks are limited.
        // This method is designed to read large streams of embedded text by calling it successively.
        internal int ReadChars(char[] buffer, int index, int count)
        {

            if (parsingFunction == ParsingFunction.InIncrementalRead)
            {
                if (incReadDecoder != readCharsDecoder)
                { // mixing ReadChars with ReadBase64 or ReadBinHex
                    if (readCharsDecoder == null)
                    {
                        readCharsDecoder = new IncrementalReadCharsDecoder();
                    }

                    readCharsDecoder.Reset();
                    incReadDecoder = readCharsDecoder;
                }

                return IncrementalRead(buffer, index, count);
            }
            else
            {
                if (curNode.type != XmlNodeType.Element)
                {
                    return 0;
                }

                if (curNode.IsEmptyElement)
                {
                    Read();
                    return 0;
                }

                if (readCharsDecoder == null)
                {
                    readCharsDecoder = new IncrementalReadCharsDecoder();
                }

                InitIncrementalRead(readCharsDecoder);
                return IncrementalRead(buffer, index, count);
            }
        }