XmlSchemaUtil.GetParserContext can return null so check was added for null before trying to access NamespaceManager on the returned object in order to prevent NullReferenceExceptions.