System.Xml.XmlTextReaderImpl.PushExternalEntityOrSubset C# (CSharp) Method

PushExternalEntityOrSubset() private method

private PushExternalEntityOrSubset ( string publicId, string systemId, Uri baseUri, string entityName ) : void
publicId string
systemId string
baseUri Uri
entityName string
return void
        private void PushExternalEntityOrSubset(string publicId, string systemId, Uri baseUri, string entityName)
        {
            Uri uri;

            // First try opening the external reference by PUBLIC Id
            if (!string.IsNullOrEmpty(publicId))
            {
                try
                {
                    uri = _xmlResolver.ResolveUri(baseUri, publicId);
                    if (OpenAndPush(uri))
                    {
                        return;
                    }
                }
                catch (Exception)
                {
                    // Intentionally empty - catch all exception related to PUBLIC ID and try opening the entity via the SYSTEM ID
                }
            }

            // Then try SYSTEM Id
            uri = _xmlResolver.ResolveUri(baseUri, systemId);
            try
            {
                if (OpenAndPush(uri))
                {
                    return;
                }
                // resolver returned null, throw exception outside this try-catch
            }
            catch (Exception e)
            {
                if (_v1Compat)
                {
                    throw;
                }
                string innerMessage = e.Message;
                Throw(new XmlException(entityName == null ? SR.Xml_ErrorOpeningExternalDtd : SR.Xml_ErrorOpeningExternalEntity, new string[] { uri.ToString(), innerMessage }, e, 0, 0));
            }

            if (entityName == null)
            {
                ThrowWithoutLineInfo(SR.Xml_CannotResolveExternalSubset, new string[] { (publicId != null ? publicId : string.Empty), systemId }, null);
            }
            else
            {
                Throw(_dtdProcessing == DtdProcessing.Ignore ? SR.Xml_CannotResolveEntityDtdIgnored : SR.Xml_CannotResolveEntity, entityName);
            }
        }
XmlTextReaderImpl