Skip to content

Instantly share code, notes, and snippets.

@poizan42
Created November 1, 2017 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poizan42/bde0e3c4e235791aadcaeb92adc1bfa9 to your computer and use it in GitHub Desktop.
Save poizan42/bde0e3c4e235791aadcaeb92adc1bfa9 to your computer and use it in GitHub Desktop.
XmlReader that supports reading a document from a stream with multiple documents
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