public XmlReaderWithSourceLocation(TextReader underlyingTextReader) { UnitTestUtility.Assert(underlyingTextReader != null, "CharacterSpottingTextReader cannot be null and should be ensured by caller."); CharacterSpottingTextReader characterSpottingTextReader = new CharacterSpottingTextReader(underlyingTextReader); this.BaseReader = XmlReader.Create(characterSpottingTextReader); UnitTestUtility.Assert(this.BaseReaderAsLineInfo != null, "The XmlReader created by XmlReader.Create should ensure this."); UnitTestUtility.Assert(this.BaseReaderAsLineInfo.HasLineInfo(), "The XmlReader created by XmlReader.Create should ensure this."); this.characterSpottingTextReader = characterSpottingTextReader; this.contentStartLocationStack = new Stack <DocumentLocation>(); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { if (this.characterSpottingTextReader != null) { ((IDisposable)this.characterSpottingTextReader).Dispose(); } this.characterSpottingTextReader = null; } }