Created
November 1, 2017 17:27
-
-
Save poizan42/bde0e3c4e235791aadcaeb92adc1bfa9 to your computer and use it in GitHub Desktop.
XmlReader that supports reading a document from a stream with multiple documents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using System.Xml; | |
internal class StreamedXmlReader : XmlTextReader | |
{ | |
private bool eof; | |
public override bool EOF => base.EOF || eof; | |
public StreamedXmlReader(TextReader input) : base(input) | |
{ | |
} | |
public override void ReadEndElement() | |
{ | |
if (Depth == 0) | |
eof = true; | |
else | |
base.ReadEndElement(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment