private bool OpenAndPush(Uri uri)
{
Debug.Assert(_xmlResolver != null);
// First try to get the data as a TextReader
if (_xmlResolver.SupportsType(uri, typeof(TextReader)))
{
TextReader textReader = (TextReader)_xmlResolver.GetEntity(uri, null, typeof(TextReader));
if (textReader == null)
{
return false;
}
PushParsingState();
InitTextReaderInput(uri.ToString(), uri, textReader);
}
else
{
// Then try get it as a Stream
Debug.Assert(_xmlResolver.SupportsType(uri, typeof(Stream)), "Stream must always be a supported type in XmlResolver");
Stream stream = (Stream)_xmlResolver.GetEntity(uri, null, typeof(Stream));
if (stream == null)
{
return false;
}
PushParsingState();
InitStreamInput(uri, stream, null);
}
return true;
}